Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call proxy server multiple times in python program #26289

Closed
chaocharleswang opened this issue Aug 9, 2020 · 1 comment
Closed

Call proxy server multiple times in python program #26289

chaocharleswang opened this issue Aug 9, 2020 · 1 comment
Labels

Comments

@chaocharleswang
Copy link

@chaocharleswang chaocharleswang commented Aug 9, 2020

Checklist

  • I'm asking a question
  • I've looked through the README and FAQ for similar questions
  • I've searched the bugtracker for similar questions including closed ones

Question

I used youtube-dl with proxy server to get json output in my python program. I found my proxy server was called 3 times.

def parse_url(url):
    
    ydl_options = {
        "dump_single_json": True,
        "proxy": "http://xxxxxxx:80",
        "nocheckcertificate": True }
    
    with youtube_dl.YoutubeDL(ydl_options) as ydl:
        try:
            info = ydl.extract_info(url, download=False)
            return info
        except Exception as e:
            return {'error': str(e)}

START RequestId: xxxxxxxxxxxx Version: $LATEST
[youtube] aFkcAH-m9W0: Downloading webpage
[youtube] aFkcAH-m9W0: Downloading js player c0a91787
[youtube] aFkcAH-m9W0: Downloading js player c0a91787
END RequestId: xxxxxxxxxxxx

However, if I call youtube-dl in my terminal like this:

youtube-dl -J https://www.youtube.com/watch?v=aFkcAH-m9W0 --proxy http://xxxxxxx:80

I tested that my proxy server was only called once.

How can I modify my python code to only call proxy server once?

@chaocharleswang chaocharleswang changed the title Called proxy server multiple times in python program Call proxy server multiple times in python program Aug 9, 2020
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 9, 2020

Do not touch youtube-dl's cache.

@dstftw dstftw closed this Aug 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.