changedotorgscraper 0.1.4__tar.gz → 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {changedotorgscraper-0.1.4 → changedotorgscraper-0.1.6}/PKG-INFO +22 -4
- changedotorgscraper-0.1.6/changedotorgscraper/__init__.py +1 -0
- {changedotorgscraper-0.1.4 → changedotorgscraper-0.1.6}/changedotorgscraper/changedotorgscraper.py +7 -3
- {changedotorgscraper-0.1.4 → changedotorgscraper-0.1.6}/changedotorgscraper.egg-info/PKG-INFO +22 -4
- {changedotorgscraper-0.1.4 → changedotorgscraper-0.1.6}/setup.py +1 -1
- changedotorgscraper-0.1.4/changedotorgscraper/__init__.py +0 -1
- {changedotorgscraper-0.1.4 → changedotorgscraper-0.1.6}/LICENSE +0 -0
- {changedotorgscraper-0.1.4 → changedotorgscraper-0.1.6}/changedotorgscraper.egg-info/SOURCES.txt +0 -0
- {changedotorgscraper-0.1.4 → changedotorgscraper-0.1.6}/changedotorgscraper.egg-info/dependency_links.txt +0 -0
- {changedotorgscraper-0.1.4 → changedotorgscraper-0.1.6}/changedotorgscraper.egg-info/requires.txt +0 -0
- {changedotorgscraper-0.1.4 → changedotorgscraper-0.1.6}/changedotorgscraper.egg-info/top_level.txt +0 -0
- {changedotorgscraper-0.1.4 → changedotorgscraper-0.1.6}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: changedotorgscraper
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: Scrapes online petition data from change.org
|
|
5
5
|
Author: Charles Alba
|
|
6
6
|
Author-email: alba@wustl.edu
|
|
@@ -16,10 +16,28 @@ Classifier: Operating System :: Microsoft :: Windows
|
|
|
16
16
|
Requires-Python: >=3.8
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE
|
|
19
|
+
Requires-Dist: requests
|
|
20
|
+
Requires-Dist: beautifulsoup4
|
|
21
|
+
Requires-Dist: lxml
|
|
22
|
+
Requires-Dist: tqdm
|
|
23
|
+
Requires-Dist: pandas
|
|
24
|
+
Requires-Dist: selenium
|
|
25
|
+
Requires-Dist: webdriver-manager
|
|
26
|
+
Dynamic: author
|
|
27
|
+
Dynamic: author-email
|
|
28
|
+
Dynamic: classifier
|
|
29
|
+
Dynamic: description
|
|
30
|
+
Dynamic: description-content-type
|
|
31
|
+
Dynamic: keywords
|
|
32
|
+
Dynamic: license
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
Dynamic: requires-dist
|
|
35
|
+
Dynamic: requires-python
|
|
36
|
+
Dynamic: summary
|
|
19
37
|
|
|
20
38
|
`changedotorgscraper` is an Python package that allows you to scrape online petition data from [change.org](https://www.change.org/).
|
|
21
39
|
|
|
22
|
-
[](https://pypi.org/project/changedotorgscraper/) [](https://github.com/cja5553/change_org_scraper)
|
|
23
41
|
|
|
24
42
|
|
|
25
43
|
|
|
@@ -33,7 +51,7 @@ pip install changedotorgscraper
|
|
|
33
51
|
Here we provide a quick example on how you can use `changedotorgscraper` to scrape petition data right from [change.org](https://www.change.org/).
|
|
34
52
|
|
|
35
53
|
```python
|
|
36
|
-
from
|
|
54
|
+
from changedotorgscraper import scrape_petitions
|
|
37
55
|
|
|
38
56
|
# Specify the url of your scrape.org searches
|
|
39
57
|
## for instance, we shall scrape petitions from the search "supplemental nutrition assistance program"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .changedotorgscraper import scrape_petitions
|
{changedotorgscraper-0.1.4 → changedotorgscraper-0.1.6}/changedotorgscraper/changedotorgscraper.py
RENAMED
|
@@ -249,6 +249,11 @@ def scrape_with_selenium(url, max_pages=None):
|
|
|
249
249
|
|
|
250
250
|
# Find all petition links
|
|
251
251
|
petition_links = soup.find_all('a', href=re.compile(r'^/p/[^/]+/?$'))
|
|
252
|
+
extracted = [extract_petition_from_card(l) for l in petition_links]
|
|
253
|
+
kept = [p for p in extracted if p]
|
|
254
|
+
print(f"page {page_num}: links={len(petition_links)} "
|
|
255
|
+
f"dropped_by_extract={len(extracted) - len(kept)} "
|
|
256
|
+
f"already_seen={sum(p['slug'] in seen_slugs for p in kept)}")
|
|
252
257
|
|
|
253
258
|
# Extract petitions from this page
|
|
254
259
|
page_petitions = []
|
|
@@ -397,8 +402,8 @@ def get_all_info(list_of_petitions, sleep_sec=0.5):
|
|
|
397
402
|
|
|
398
403
|
def scrape_petitions(url,max_pages=None):
|
|
399
404
|
if max_pages==None:
|
|
400
|
-
print("No max pages specified, defaulting to
|
|
401
|
-
max_pages=
|
|
405
|
+
print("No max pages specified, defaulting to 200 pages")
|
|
406
|
+
max_pages=200
|
|
402
407
|
else:
|
|
403
408
|
pass
|
|
404
409
|
list_of_petitions = get_petitions(url, max_pages=max_pages)
|
|
@@ -420,4 +425,3 @@ def scrape_petitions(url,max_pages=None):
|
|
|
420
425
|
|
|
421
426
|
return(df)
|
|
422
427
|
|
|
423
|
-
|
{changedotorgscraper-0.1.4 → changedotorgscraper-0.1.6}/changedotorgscraper.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: changedotorgscraper
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: Scrapes online petition data from change.org
|
|
5
5
|
Author: Charles Alba
|
|
6
6
|
Author-email: alba@wustl.edu
|
|
@@ -16,10 +16,28 @@ Classifier: Operating System :: Microsoft :: Windows
|
|
|
16
16
|
Requires-Python: >=3.8
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE
|
|
19
|
+
Requires-Dist: requests
|
|
20
|
+
Requires-Dist: beautifulsoup4
|
|
21
|
+
Requires-Dist: lxml
|
|
22
|
+
Requires-Dist: tqdm
|
|
23
|
+
Requires-Dist: pandas
|
|
24
|
+
Requires-Dist: selenium
|
|
25
|
+
Requires-Dist: webdriver-manager
|
|
26
|
+
Dynamic: author
|
|
27
|
+
Dynamic: author-email
|
|
28
|
+
Dynamic: classifier
|
|
29
|
+
Dynamic: description
|
|
30
|
+
Dynamic: description-content-type
|
|
31
|
+
Dynamic: keywords
|
|
32
|
+
Dynamic: license
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
Dynamic: requires-dist
|
|
35
|
+
Dynamic: requires-python
|
|
36
|
+
Dynamic: summary
|
|
19
37
|
|
|
20
38
|
`changedotorgscraper` is an Python package that allows you to scrape online petition data from [change.org](https://www.change.org/).
|
|
21
39
|
|
|
22
|
-
[](https://pypi.org/project/changedotorgscraper/) [](https://github.com/cja5553/change_org_scraper)
|
|
23
41
|
|
|
24
42
|
|
|
25
43
|
|
|
@@ -33,7 +51,7 @@ pip install changedotorgscraper
|
|
|
33
51
|
Here we provide a quick example on how you can use `changedotorgscraper` to scrape petition data right from [change.org](https://www.change.org/).
|
|
34
52
|
|
|
35
53
|
```python
|
|
36
|
-
from
|
|
54
|
+
from changedotorgscraper import scrape_petitions
|
|
37
55
|
|
|
38
56
|
# Specify the url of your scrape.org searches
|
|
39
57
|
## for instance, we shall scrape petitions from the search "supplemental nutrition assistance program"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .ChangeDotOrgScraper import scrape_petitions
|
|
File without changes
|
{changedotorgscraper-0.1.4 → changedotorgscraper-0.1.6}/changedotorgscraper.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{changedotorgscraper-0.1.4 → changedotorgscraper-0.1.6}/changedotorgscraper.egg-info/requires.txt
RENAMED
|
File without changes
|
{changedotorgscraper-0.1.4 → changedotorgscraper-0.1.6}/changedotorgscraper.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|