You are not logged in.

#1 Yesterday 21:07:22

FernandoBasso
Member
From: Brazil
Registered: 2010-10-27
Posts: 105
Website

How to craft the URL where where a program is downloaded from?

The company I currently work with is switching from Loom for screen recording to Cap (https://cap.so). Thankfully, it supports Linux, but only provides .deb package.

When I downloaded it from the website, the button shows https://cap.so/download/linux-deb. But after the download starts, and I copy the download link from Firefox download history, then it shows like this:

https://cdn.crabnebula.app/asset/01M2JEFM7ZZKVZT9YPEKWWFPD7?from=%7B%22orgSlug%22%3A%22cap%22%2C%22appSlug%22%3A%22cap%22%2C%22publicPlatform%22%3A%22deb-x86_64%22%7D

The file name it suggests by default is "Cap_0.6.0_amd64.deb".

So my question is: how should I craft that URL into the url field of the PKGBUILD so that when I run makepkg, the download works correctly?

Let me know if any further information is required or would help.


There is a difference between knowing the path and walking the path.

Offline

#2 Yesterday 21:37:22

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,662
Website

Re: How to craft the URL where where a program is downloaded from?

Are you talking about automatically renaming a downloaded source file?

man PKGBUILD wrote:
It  is  also  possible  to  change the name of the downloaded file, which is
helpful with weird URLs and for handling multiple source files with the same
name. The syntax is: source=('filename::url').

Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 Yesterday 23:19:56

FernandoBasso
Member
From: Brazil
Registered: 2010-10-27
Posts: 105
Website

Re: How to craft the URL where where a program is downloaded from?

No, I mean that I am not sure what I should put in the "url" and the "source" fields of the PKGBUILD.


There is a difference between knowing the path and walking the path.

Offline

#4 Today 05:09:51

cryptearth
Member
Registered: 2024-02-03
Posts: 2,344

Re: How to craft the URL where where a program is downloaded from?

nothing, because there's a arch pkg already provided: https://cap.so/download/versions
https://cap.so/download/linux-pacman

Last edited by cryptearth (Today 05:10:22)

Offline

#5 Today 09:05:54

FernandoBasso
Member
From: Brazil
Registered: 2010-10-27
Posts: 105
Website

Re: How to craft the URL where where a program is downloaded from?

cryptearth wrote:

nothing, because there's a arch pkg already provided: https://cap.so/download/versions
https://cap.so/download/linux-pacman

That is awesome, thank you!

As a learning opportunity, I'd still like to understand what I should do regarding "url" and "source" for this case.


There is a difference between knowing the path and walking the path.

Offline

#6 Today 11:12:31

cryptearth
Member
Registered: 2024-02-03
Posts: 2,344

Re: How to craft the URL where where a program is downloaded from?

depends on versioning
packages should have a fixed version - so it should use a fixed url
i also checked thier github but it, too, only contains auto "latest" links which are resolved from the server with a 302 redirect - these are not suitable for a versioned package
here the original dev has to come forward to provide fixed version direct links
i won't rely on the backend cdn links as these are usually auto generated and subject to change

if cap.so only provides one version via a "latest" link it's up to them - nothin a user should try to interfere with

another COULD be: as they provide a public repo one could try to figure out how they built thier package specific to arch and could try to replicate this - but this could also lead to conflicts (naming, licence) - in this very case i would request cap.so to maybe provide an aur -bin package themself - if they deny then you should accept it (although it wouldn't do the community a favor to not utilize existing packaging and version control infrastructure)

Offline

#7 Today 13:29:42

DeaD_EyE
Member
Registered: 2022-11-13
Posts: 6

Re: How to craft the URL where where a program is downloaded from?

With curl

URL=$(curl -s -I -w "%header{location}\n" -o /dev/null https://cap.so/download/linux-deb)

Python

from urllib.request import Request, urlopen

url = "https://cap.so/download/linux-deb"
headers = {
    "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:156.0) Gecko/20100101 Firefox/156.0"
}
request = Request(url, method="HEAD", headers=headers)
url = urlopen(request).url

Python with requests

import requests

url = requests.head("https://cap.so/download/linux-deb").headers.get("location")

Offline

Board footer

Powered by FluxBB