-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscrape03online_n_questions_per_doctor.py
50 lines (42 loc) · 1.38 KB
/
scrape03online_n_questions_per_doctor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from bs4 import BeautifulSoup
# import pandas as pd
import json
from pprint import pprint
import requests
import re
import time
from scrape03online import get_n_question_blocks_per_doc, scrape_question
the_url = "http://03online.com"
doctor_link = 'http://03online.com/news/allergolog/1-0-23'
doc = {
'link': doctor_link,
'max_page': 457,
'question_links': [],
'questions': []
}
get_n_question_blocks_per_doc('allergolog', doc, blocks=457)
## questions/answers per doc
# ql = 'http://03online.com/news/nizkiy_ig_e_no_vysypaniya_ne_prohodyat/2017-9-22-337601'
# questions_per_block = []
# req = requests.get(ql)
# # q = scrape_question(req.text)
# soup = BeautifulSoup(req.text, 'html.parser')
# ans = soup.select('#answers_block > div.answer-block.doctor-block > div.body.right')[0]
# # print(q)
# print(ans)
#
# answer = {
# 'doctor_name': ans.select('div.header > a')[0].text,
# 'doctor': ans.select('div.header > span.doctor')[0].text,
# 'date': ans.select('div.header > span.date')[0].text,
# 'content': ans.select('div.content')[0].text,
# }
#
# print()
# pprint(answer)
# req = requests.get(doctor_link)
# soup = BeautifulSoup(req.text, 'html.parser')
#
# el = soup.select('div[class="question-short-block"]')[0].select('div.extra > div.comments > div.value')[0].text
#
# print(el)