Open wm-tbourne opened 3 years ago
Has always worked for all of us like this....This seems very isolated....
# Get M3U file from provider
response = urllib.request.urlopen(url)
data = response.read()
providerM3uFile = data.decode('utf-8')
We need a few tests to make sure it works as expected for all. @marmei
I just tested a old script I had and replaced (url) with (req) and the script would not run.....
@MCTyler weird – only works for me if I change out url
to req`. I'm also running this using Python 3. 🤷
See this stack overflow post https://stackoverflow.com/a/36532952.. to me it seems like if you're passing in URL you're completely ignoring the line where you're setting req
. If you're not passing in req
what is it being set for?
url = "https://www.example.com"
# pretend to be a chrome 47 browser on a windows 10 machine
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"}
req = urlRequest.Request(url, headers = headers)
# open the url
x = urlRequest.urlopen(req)
# get the source code
sourceCode = x.read()
Your right, if Provider doesn't care what Header is used, like mine, then it just works...If Provider blocks some User-Agents then your edit will resolve that with the proper Header...Change meets my approval..... @marmei
I think user-agent should remain VLC since it's universally excepted....
#Headers
headers = {'User-Agent': 'VLC'}
Pull request submitted by @MCTyler was approved --LeeD
Switching to my personal account – @MCTyler thanks for pushing this through! I know it's not a huge deal but will help if someone runs into 403
s using this script.. and I totally agree that VLC as User-Agent
should work fine here.
Great...Can you close this Please. @taylorbourne
https://github.com/xteve-repo/scripts/blob/master/CUID_IncExclude.py#L16
I believe the above line should be:
Seems to work as expected when I make the change