Issue
https://anime-world.in/?trembed=0&trid=1930&trtype=2 This link contains just an iframe tag and I want to download the video linked in it. However, the src attribute takes me to a page that is inaccessible. I want to know how can I possibly download the video. I have tried going to the source site (error 403) and I have also tried looking in the network panel, could not find anything there. Thanks for the help!
Solution
You can use this script how to download the video from the URL:
import re
import requests
from bs4 import BeautifulSoup
url = "https://anime-world.in/?trembed=0&trid=1930&trtype=2"
headers = {
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0",
"Referer": "https://anime-world.in/",
}
with requests.session() as s:
soup = BeautifulSoup(s.get(url, headers=headers).content, "html.parser")
url2 = soup.iframe["src"]
html_doc = s.get(url2, headers=headers).text
link = re.search(r'file:".*?(http[^",]+)', html_doc).group(1)
print(link)
with open("file.mp4", "wb") as f:
f.write(s.get(link, headers=headers, verify=False).content)
print("Done.")
This prints:
https://6-yt5mQW3xieQHnfPa.server1cdn.xyz/link/AWI165B50FD/360/bb55f30227f8db11dcd19fef59fd6e5f/?sid=f3439234305d48ff7424333b2ca2de77
Done.
and saves file.mp4
with video (it takes a little while to download it.)
Answered By - Andrej Kesely
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.