我这里有这个网址,我正在尝试获取视频的源链接,但它位于iframe中。视频网址https://ndisk.cizgifilmlerizle.com...
在名为vjs_iframe
的 iframe 中。我的代码如下:
import requests
from bs4 import BeautifulSoup
url = "https://m.wcostream.com/my-hero-academia-season-4-episode-5-english-dubbed"
r = requests.Session()
headers = {"User-Agent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0"} # Noticed that website responds better with headers
req = r.get(url, headers=headers)
soup = BeautifulSoup(req.content, 'html.parser')
iframes = soup.find_all("iframe") # Returns an empty list
vjs_iframe = soup.find_all(class_="vjs_iframe") # Also returns an empty list
我不知道如何在 iframe 中获取 url,因为即使是 iframe 的源也不会在第一次请求时加载。是否可以使用BeautifulSoup
获取https://ndisk.cizgifilmlerizle.com...
URL,或者我是否需要使用另一个库(如selenium
或其他库(?提前感谢!
我抓取他们东西的方法如下。 Idk,如果你不再需要这个,但我正在寻找那个https://ndisk.cizgifilmlerizle.com
网站的问题,并看到了这个。 认为它可能会帮助其他人。 这很粗糙,但可以完成工作。
import time
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.chrome.options import Options
from selenium.webenter code heredriver.common.by import By
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
from time import sleep
import os
import string
# tab 5, space, up arrow 2, space
def do_keys(key, num_times, action_chain):
for x in range(num_times):
action_chain.send_keys(key)
def cls():
print("