- Beranda
- Komunitas
- Tech
- Programmer Forum
[Python] Grab Site dengan BeautifulSoup
TS
adyoi
[Python] Grab Site dengan BeautifulSoup
Untuk pengguna windows download terlebih dahulu Python versi 2.7
https://www.activestate.com/activepython/downloads
cara install beautifulsoup4 perintah menggunakan :
sudah terinstall
contoh penggunaan nya :
output nya
Cara Grab Site dengan Python BeautifulSoup :
HT kaskus hari ini (7/6/17-2:26)
https://www.activestate.com/activepython/downloads
cara install beautifulsoup4 perintah menggunakan :
Quote:
sudah terinstall
contoh penggunaan nya :
PHP Code:
#!/usr/bin/python
#
# tes.py
from BeautifulSoup import BeautifulSoup
html = "<b>1</b><b>2</b><b>3</b>"
soup = BeautifulSoup(html)
grab = soup.findAll('b')
for item in grab:
print item.text
output nya
Cara Grab Site dengan Python BeautifulSoup :
PHP Code:
#!/usr/bin/python
#
# Kaskus HT by Adyoi
from BeautifulSoup import BeautifulSoup as BS
import urllib2
opener = urllib2.build_opener()
opener.addheaders = [('User-Agent', 'Mozilla/5.0')]
html = opener.open('https://www.kaskus.co.id/')
soup = BS(html)
elem = soup.findAll('a')
for item in elem:
if item.get('name') == 'ht_title':
for itemz in item.findAll('h3'):
print itemz.text
HT kaskus hari ini (7/6/17-2:26)
Diubah oleh adyoi 06-07-2017 07:53
nona212 memberi reputasi
1
1.4K
1
Guest
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
Urutan
Terbaru
Terlama
Guest
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
Komunitas Pilihan