-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
22 lines (22 loc) · 749 Bytes
/
__init__.py
File metadata and controls
22 lines (22 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# -*- encoding:utf-8 -*-
import requests
from bs4 import BeautifulSoup
from tabulate import tabulate
data = []
headers = ['moviename','language','year']
data.append(headers)
resp = requests.get('https://www.moviebuff.com/directory/movies')
# print(resp.content)
jsoup = BeautifulSoup(resp.content)
row_filter = jsoup.find_all('div',attrs = {'class':'row filter-row'})
# print(row_filter)
if len(row_filter) != 0:
for k in row_filter:
k.decompose()
jsoup = jsoup.find_all('div',attrs={'class':'row'})
if len(jsoup)!=0:
for row in jsoup:
for col in row.find_all('div',attrs = {'class':'col-md-4'}):
j = [k.strip() for k in col.text.split('|')]
data.append(j)
print(tabulate(data))