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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: changedotorgscraper
3
- Version: 0.1.4
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
- [![pypi package](https://img.shields.io/badge/pypi_package-v0.1.4-brightgreen)](https://pypi.org/project/ChangeDotOrgScraper/) [![GitHub Source Code](https://img.shields.io/badge/github_source_code-source_code?logo=github&color=green)](https://github.com/cja5553/change_org_scraper)
40
+ [![pypi package](https://img.shields.io/badge/pypi_package-v0.1.5-brightgreen)](https://pypi.org/project/changedotorgscraper/) [![GitHub Source Code](https://img.shields.io/badge/github_source_code-source_code?logo=github&color=green)](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 ChangeDotOrgScraper import scrape_petitions
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
@@ -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 10 pages")
401
- max_pages=10
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
-
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: changedotorgscraper
3
- Version: 0.1.4
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
- [![pypi package](https://img.shields.io/badge/pypi_package-v0.1.4-brightgreen)](https://pypi.org/project/ChangeDotOrgScraper/) [![GitHub Source Code](https://img.shields.io/badge/github_source_code-source_code?logo=github&color=green)](https://github.com/cja5553/change_org_scraper)
40
+ [![pypi package](https://img.shields.io/badge/pypi_package-v0.1.5-brightgreen)](https://pypi.org/project/changedotorgscraper/) [![GitHub Source Code](https://img.shields.io/badge/github_source_code-source_code?logo=github&color=green)](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 ChangeDotOrgScraper import scrape_petitions
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"
@@ -11,7 +11,7 @@ if os.path.exists(readme_path):
11
11
  else:
12
12
  long_description = ""
13
13
 
14
- VERSION = "0.1.4"
14
+ VERSION = "0.1.6"
15
15
  DESCRIPTION = "Scrapes online petition data from change.org"
16
16
 
17
17
  setup(
@@ -1 +0,0 @@
1
- from .ChangeDotOrgScraper import scrape_petitions