pget icon indicating copy to clipboard operation
pget copied to clipboard

feat: add default user-agent string

Open septs opened this issue 1 year ago • 1 comments

user-agent string like Wget

$ pget https://mirrors.tuna.tsinghua.edu.cn/archlinux/iso/latest/archlinux-2022.10.01-x86_64.iso
2.40 KiB / 798.32 MiB [>____________________________________________________________________________________________] 0.00% 1.75 MiB p/s

binding with files...
2.40 KiB / 798.32 MiB [>___________________________________________________________________________________________________] 0.00% ? p/s
$ cat archlinux-2022.10.01-x86_64.iso
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>清华大学 TUNA 镜像站</title>
    <link href="//cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
    <style> body { padding-top: 40px; } </style>
  </head>
  <body>
    <div class="container">
      <div class="well">
        <p lang="zh-cn">尊敬的访问者,</p>
		<p lang="en">Dear visitor, </p>
		<p lang="fr">Chère cliente, </p>
		<p lang="ja">訪問者へ 、</p>
		<p>&nbsp;</p>
        <p lang="zh-cn">您好!</p>
		<p lang="en">Hello! </p>
		<p lang="fr">Bonjour! </p>
		<p lang="ja">こんにちは !</p>
		<p>&nbsp;</p>
        <p lang="zh-cn">我们检测到您正在使用移动设备下载镜像站上较大的二进制文件,为防止消耗过多流量,我们建议您改用计算机下载。</p>
		<p lang="en">Your attempt to download a large binary file from a mobile device has been detected. To avoid excessive consumption of data transfer, you are recommended to download it from a computer. </p>
		<p lang="fr">Une tentative de téléchargement d'un fichier binaire de grande taille depuis un appareil mobile a été détectée. Afin d'éviter une consommation excessive de données mobile, nous vous conseillons de recommencer cette action à partir d'un ordinateur. </p>
		<p lang="ja">容量の大きいバイナリファイルが今モバイルデバイスに転送しようとしております、大量のトラフィックが発生するため、コンピュータからのダウンロードをお勧めします。</p>
		<p>&nbsp;</p>
		<p lang="zh-cn">如有疑问,请联系 <a href="mailto:[email protected]">[email protected]</a> 。</p>
		<p lang="en">If there are any possible questions, please contact <a href="mailto:[email protected]">[email protected]</a>. </p>
		<p lang="fr">Pour plus d'informations, veuillez contacter <a href="mailto:[email protected]">[email protected]</a>. </p>
		<p lang="ja">なおご質問などありましたら、<a href="mailto:[email protected]">[email protected]</a>までご連絡してください。</p>
		<p>&nbsp;</p>
                <p><code>00000070 37eec832d885647d98c2056b54651fd4</code></p>
      </div>
    </div>
  </body>
</html>
$ pget --user-agent 'Pget/0.1.1' https://mirrors.tuna.tsinghua.edu.cn/archlinux/iso/latest/archlinux-2022.10.01-x86_64.iso
1.04 MiB / 798.32 MiB [>__________________________________________________________________________________________] 0.13% 894.55 KiB p/s^C

septs avatar Oct 18 '22 15:10 septs

Codecov Report

Merging #57 (54dd6ed) into master (7c82871) will increase coverage by 0.71%. The diff coverage is 100.00%.

:exclamation: Current head 54dd6ed differs from pull request most recent head 12ae3ab. Consider uploading reports for the commit 12ae3ab to get more accurate results

@@            Coverage Diff             @@
##           master      #57      +/-   ##
==========================================
+ Coverage   69.56%   70.27%   +0.71%     
==========================================
  Files           7        7              
  Lines         506      508       +2     
==========================================
+ Hits          352      357       +5     
+ Misses        114      112       -2     
+ Partials       40       39       -1     
Impacted Files Coverage Δ
download.go 73.62% <100.00%> (+1.95%) :arrow_up:
pget.go 55.55% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Oct 19 '22 12:10 codecov[bot]