This commit is contained in:
jarbasal 2018-04-18 17:51:41 +01:00
parent df14f2625e
commit acd29067f5
2 changed files with 2 additions and 6 deletions

View File

@ -187,11 +187,7 @@ class Erowid(object):
report["substance"] = fields[2].getText() report["substance"] = fields[2].getText()
report["date"] = fields[3].getText() report["date"] = fields[3].getText()
report["url"] = base_url + r.find("a")["href"] report["url"] = base_url + r.find("a")["href"]
report["exp_id"] = report["url"].split("=")[1]
reports.append(report) reports.append(report)
return reports return reports
reports = Erowid.search_reports("1P-LSD")
print reports[0].keys()
for report in reports[:5]:
print report["substance"], report["url"], report["date"]

View File

@ -51,7 +51,7 @@ searching experience reports
output output
['date', 'url', 'substance', 'name', 'author'] ['substance', 'name', 'author', 'url', 'date', 'exp_id']
1P-ETH-LAD https://erowid.org/experiences/exp.php?ID=109647 Dec 9 2016 1P-ETH-LAD https://erowid.org/experiences/exp.php?ID=109647 Dec 9 2016
1P-LSD https://erowid.org/experiences/exp.php?ID=108914 Aug 1 2016 1P-LSD https://erowid.org/experiences/exp.php?ID=108914 Aug 1 2016
1P-LSD https://erowid.org/experiences/exp.php?ID=108138 Mar 16 2016 1P-LSD https://erowid.org/experiences/exp.php?ID=108138 Mar 16 2016