查询URL:
https://myanimelist.net/search/all?q=
功能:
仅爬取动漫名对应的图片链接
未解决bug:
- 预防机器人检测,网页不定时机器人检测,禁止访问时间大概1-3分钟,不锁IP,采用time.sleep解决
- 未采用轮询查找当前项,直接填充null,跳过,因为数据量较小,以后再改进
代码
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import requests
from bs4 import BeautifulSoup
import csv
import time
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36'
}
def getAnimeName():
nameList = []
with open("./name_empty.csv", 'r') as f1:
for line in f1.readlines():
nameList.append(line.strip