여러 줄의 YouTube 사용자 이름이있는 .txt 파일을 가져 와서 YouTube 사용자 홈페이지 URL에 추가하고 크롤링하여 프로필 데이터Python/BeautifulSoup으로 .txt 파일에서 여러 URL 반복하기.
아래 코드는 한 사용자에게 필요한 정보를 제공하지만 여러 URL을 가져 와서 반복 할 위치를 알 수 없습니다.
#!/usr/bin/env python
# -- coding: utf-8 --
from bs4 import BeautifulSoup
import re
import urllib2
# download the page
response = urllib2.urlopen("http://youtube.com/user/alxlvt")
html = response.read()
# create a beautiful soup object
soup = BeautifulSoup(html)
# find the profile info & display it
profileinfo = soup.findAll("div", { "class" : "user-profile-item" })
for info in profileinfo:
print info.get_text()
누구에게 권장 사항이 있습니까? .
예, 본인은 .txt 파일이 있다면 :
username1
username2
username3
etc.
가 어떻게 http://youtube.com/user/%s로 추가, 사람들을 반복하고, 모든 정보를 당길 루프를 만드는 방법에 대해 갈 수 있습니까?