![]() You should use a library like Requests or pycurl to add headers to your requests and they should work fine. The list turns out empty because you're making an HTTP request without headers (which means you're doing it programmatically for sure) and most sites just respond to those with 403 outright. I still don't know how to initialize streaming from python, without opening the page in the browser. Probably opening the webpage initiates the streaming and this creates m3u8 file on the server that can be requested. Otherwise the playlist is gonna be empty. The only problem left, is that in order to load the playlist i need first to open the webpage in a browser. ![]() The playlist of the video files will then be something like that ['',Īnd I can download each of the video files from the list. One can use m3u8 module (installable by pip) like this: import m3u8 ![]() Next, i've found out how to get the addresses of. I looked in Chrome devtools 'network' what requests are sent by browser to get the live stream, and just copied the most fresh one, it requests some. ![]() What I've change is 1) in open(filename,'wb') changed 'w' to 'wb' to write binary data, but most important 2) changed url. Now i can get some piece of video written in the file. Print("Received unexpected status code ".format(r.status_code)) I don't really have any experience with video streaming and web scraping generally, so after searching for the info in internet, i came up with this naive code in python: url=''įor chunk in r1.iter_content(chunk_size=1024): For my image classification project I need to collect classified images, and for me a good source would be different webcams around the world streaming video in the internet.
0 Comments
Leave a Reply. |