跨境电商:Python获取Redbubble标签

电脑技术 电脑技术 1228 人阅读 | 0 人回复 | 2022-04-11

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
import requests
from bs4 import BeautifulSoup as bs
from pyperclip import copy

site = requests.get(input("SITE >"))
blackwords = (input("BLACKWORDS (comma separated) >")).split(",")
blackwords = [each.casefold() for each in blackwords]

site = bs(site.text)

a = site.find_all("div", {"id" :  "work-tags"})
b = [each.find_all("span", {"class" : "styles__children--21o3C"}) for each in a]
c = [each.contents for each in b[0]]
d = sum(c, [])
e = [each for each in d if each.casefold() not in blackwords]
f = ",".join(e)

copy(f)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

热门推荐