From d0ed3e52ba5e01c4436339fae36c23a66fc8cb75 Mon Sep 17 00:00:00 2001 From: Tianyi Zheng Date: Mon, 19 Aug 2024 21:54:30 -0700 Subject: [PATCH] Completely rewrite news.py and unit tests Rewrite the news module because the underlying news API has been dead for years. The rewritten news.py scrapes the Pittwire website for official Pitt news articles. The rewritten unit tests for news.py mocks API requests and achieves 100% code coverage with pytest. --- pittapi/news.py | 157 +- tests/news_test.py | 243 ++- ...niversity_news_features_articles_2020.html | 1241 ++++++++++++ ...sity_news_features_articles_fulbright.html | 1209 ++++++++++++ ...versity_news_features_articles_page_0.html | 1755 +++++++++++++++++ ...versity_news_features_articles_page_1.html | 1743 ++++++++++++++++ 6 files changed, 6257 insertions(+), 91 deletions(-) create mode 100644 tests/samples/news_university_news_features_articles_2020.html create mode 100644 tests/samples/news_university_news_features_articles_fulbright.html create mode 100644 tests/samples/news_university_news_features_articles_page_0.html create mode 100644 tests/samples/news_university_news_features_articles_page_1.html diff --git a/pittapi/news.py b/pittapi/news.py index 4b9b28c..ae1462c 100644 --- a/pittapi/news.py +++ b/pittapi/news.py @@ -17,56 +17,109 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. """ -import math -import requests -import grequests -from typing import Any - -sess = requests.session() - - -def _load_n_items(feed: str, max_news_items: int): - payload = { - "feed": feed, - "id": "", - "_object": "kgoui_Rcontent_I0_Rcontent_I0", - "start": 0, - } - - request_objs = [] - for i in range(int(math.ceil(max_news_items / 10))): - payload["start"] = i * 10 - request_objs.append(grequests.get("https://m.pitt.edu/news/index.json", params=payload)) - - responses = grequests.imap(request_objs) - - return responses +from __future__ import annotations - -def get_news(feed: str = "main_news", max_news_items: int = 10) -> list[dict[str, Any]]: - # feed indicates the desired news feed - # 'main_news' - main news - # 'cssd' - student announcements, on my pitt - # 'news_chronicle' - the Pitt Chronicle news - # 'news_alerts' - crime alerts - - news = [] - - resps = _load_n_items(feed, max_news_items) - resps = [r.json()["response"]["regions"][0]["contents"] for r in resps] - - for resp in resps: - for data in resp: - fields = data["fields"] - if fields["type"] == "loadMore": - continue - - # TODO: Look into why this gives a Type Error during the news alert test. - try: - title = fields["title"] - url = "https://m.pitt.edu" + fields["url"]["formatted"] - news.append({"title": title, "url": url}) - except TypeError: - continue - - return news[:max_news_items] +import math +from requests_html import Element, HTMLResponse, HTMLSession +from typing import Literal, NamedTuple + +NUM_ARTICLES_PER_PAGE = 20 + +NEWS_BY_CATEGORY_URL = ( + "https://www.pitt.edu/pittwire/news/{category}?field_topics_target_id={topic_id}&field_article_date_value={year}" + "&title={query}&field_category_target_id=All&page={page_num}" +) +PITT_BASE_URL = "https://www.pitt.edu" + +Category = Literal["features-articles", "accolades-honors", "ones-to-watch", "announcements-and-updates"] +Topic = Literal[ + "university-news", + "health-and-wellness", + "technology-and-science", + "arts-and-humanities", + "community-impact", + "innovation-and-research", + "global", + "diversity-equity-and-inclusion", + "our-city-our-campus", + "teaching-and-learning", + "space", + "ukraine", + "sustainability", +] + +TOPIC_ID_MAP: dict[Topic, int] = { + "university-news": 432, + "health-and-wellness": 2, + "technology-and-science": 391, + "arts-and-humanities": 4, + "community-impact": 6, + "innovation-and-research": 1, + "global": 9, + "diversity-equity-and-inclusion": 8, + "our-city-our-campus": 12, + "teaching-and-learning": 7, + "space": 440, + "ukraine": 441, + "sustainability": 470, +} + +sess = HTMLSession() + + +class Article(NamedTuple): + title: str + description: str + url: str + tags: list[str] + + @classmethod + def from_html(cls, article_html: Element) -> Article: + article_heading: Element = article_html.find("h2.news-card-title a", first=True) + article_subheading: Element = article_html.find("p", first=True) + article_tags_list: list[Element] = article_html.find("ul.news-card-tags li") + + article_title = article_heading.text.strip() + article_url = PITT_BASE_URL + article_heading.attrs["href"] + article_description = article_subheading.text.strip() + article_tags = [tag.text.strip() for tag in article_tags_list] + + return cls(title=article_title, description=article_description, url=article_url, tags=article_tags) + + +def _get_page_articles( + topic: Topic, + category: Category, + query: str, + year: int | None, + page_num: int, +) -> list[Article]: + year_str = str(year) if year else "" + page_num_str = str(page_num) if page_num else "" + response: HTMLResponse = sess.get( + NEWS_BY_CATEGORY_URL.format( + category=category, topic_id=TOPIC_ID_MAP[topic], year=year_str, query=query, page_num=page_num_str + ) + ) + main_content: Element = response.html.xpath("/html/body/div/main/div/section", first=True) + news_cards: list[Element] = main_content.find("div.news-card") + page_articles = [Article.from_html(news_card) for news_card in news_cards] + return page_articles + + +def get_articles_by_topic( + topic: Topic, + category: Category = "features-articles", + query: str = "", + year: int | None = None, + max_num_results: int = NUM_ARTICLES_PER_PAGE, +) -> list[Article]: + num_pages = math.ceil(max_num_results / NUM_ARTICLES_PER_PAGE) + + # Get articles sequentially and synchronously (i.e., not using grequests) because the news pages must stay in order + results: list[Article] = [] + for page_num in range(num_pages): # Page numbers in url are 0-indexed + page_articles = _get_page_articles(topic, category, query, year, page_num) + num_articles_to_add = min(len(page_articles), max_num_results - len(results)) + results.extend(page_articles[:num_articles_to_add]) + return results diff --git a/tests/news_test.py b/tests/news_test.py index e4aef05..203b684 100644 --- a/tests/news_test.py +++ b/tests/news_test.py @@ -17,48 +17,213 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. """ +import responses import unittest -from pittapi import news - - -@unittest.skip -class NewsTest(unittest.TestCase): - def test_get_news_default(self): - self.assertIsInstance(news.get_news(), list) - - def test_get_news_main(self): - self.assertIsInstance(news.get_news("main_news"), list) - - def test_get_news_cssd(self): - self.assertIsInstance(news.get_news("cssd"), list) - - def test_get_news_chronicle(self): - self.assertIsInstance(news.get_news("news_chronicle"), list) +from pathlib import Path - def test_get_news_alerts(self): - self.assertIsInstance(news.get_news("news_alerts"), list) - - def test_get_news_length_nine(self): - self.assertTrue(0 < len(news.get_news(max_news_items=9)) <= 9) - - def test_get_news_length_ten(self): - self.assertTrue(0 < len(news.get_news(max_news_items=10)) <= 10) - - def test_get_news_length_eleven(self): - self.assertTrue(0 < len(news.get_news(max_news_items=11)) <= 11) - - def test_get_news_length_twenty(self): - self.assertTrue(0 < len(news.get_news(max_news_items=20)) <= 20) - - def test_get_news_length_twentyfive(self): - self.assertTrue(0 < len(news.get_news(max_news_items=25)) <= 25) +from pittapi import news - def test_get_news_length_twentynine(self): - self.assertTrue(0 < len(news.get_news(max_news_items=29)) <= 29) +SAMPLE_PATH = Path() / "tests" / "samples" - def test_get_news_length_thirty(self): - self.assertTrue(0 < len(news.get_news(max_news_items=30)) <= 30) - def test_get_news_length_forty(self): - self.assertTrue(0 < len(news.get_news(max_news_items=40)) <= 40) +class NewsTest(unittest.TestCase): + def __init__(self, *args, **kwargs): + unittest.TestCase.__init__(self, *args, **kwargs) + with (SAMPLE_PATH / "news_university_news_features_articles_page_0.html").open() as f: + self.university_news_features_articles_page_0 = f.read() + with (SAMPLE_PATH / "news_university_news_features_articles_page_1.html").open() as f: + self.university_news_features_articles_page_1 = f.read() + with (SAMPLE_PATH / "news_university_news_features_articles_fulbright.html").open() as f: + self.university_news_features_articles_fulbright = f.read() + with (SAMPLE_PATH / "news_university_news_features_articles_2020.html").open() as f: + self.university_news_features_articles_2020 = f.read() + + @responses.activate + def test_get_articles_by_topic(self): + responses.add( + responses.GET, + "https://www.pitt.edu/pittwire/news/features-articles?field_topics_target_id=432&field_article_date_value=&title=" + "&field_category_target_id=All", + body=self.university_news_features_articles_page_0, + ) + + university_news_articles = news.get_articles_by_topic("university-news") + + self.assertEqual(len(university_news_articles), news.NUM_ARTICLES_PER_PAGE) + self.assertEqual( + university_news_articles[0], + news.Article( + title="Questions for the ‘Connecting King’", + description="Vernard Alexander, the new director of Pitt’s Homewood Community Engagement Center, " + "sees himself as the ultimate connector.", + url="https://www.pitt.edu/pittwire/pittmagazine/features-articles/vernard-alexander-community-engagement", + tags=["University News", "Community Impact"], + ), + ) + self.assertEqual( + university_news_articles[-1], + news.Article( + title="John Surma is Pitt’s 2024 spring commencement speaker", + description="The University will also honor the Board of Trustees member and former U. S. Steel CEO " + "with an honorary degree.", + url="https://www.pitt.edu/pittwire/features-articles/2024-spring-commencement-speaker-john-surma", + tags=["University News", "Commencement"], + ), + ) + + @responses.activate + def test_get_articles_by_topic_query(self): + query = "fulbright" + responses.add( + responses.GET, + "https://www.pitt.edu/pittwire/news/features-articles?field_topics_target_id=432&field_article_date_value=" + f"&title={query}&field_category_target_id=All", + body=self.university_news_features_articles_fulbright, + ) + + university_news_articles = news.get_articles_by_topic("university-news", query=query) + + self.assertEqual(len(university_news_articles), 3) + self.assertEqual( + university_news_articles[0], + news.Article( + title="Meet Pitt’s 2024 faculty Fulbright winners", + description="The Fulbright U.S. Scholar Program offers faculty the opportunity " + "to teach and conduct research abroad.", + url="https://www.pitt.edu/pittwire/features-articles/faculty-fulbright-scholars-2024", + tags=["University News", "Innovation and Research", "Global", "Faculty"], + ), + ) + self.assertEqual( + university_news_articles[-1], + news.Article( + title="Pitt has been named a top producer of Fulbright U.S. students for 2022-23", + description="Meet the nine Pitt scholars in this year’s cohort.", + url="https://www.pitt.edu/pittwire/features-articles/pitt-fulbright-top-producing-institution-2022-2023", + tags=[ + "University News", + "Global", + "David C. Frederick Honors College", + "Kenneth P. Dietrich School of Arts and Sciences", + "School of Education", + "Swanson School of Engineering", + ], + ), + ) + + @responses.activate + def test_get_articles_by_topic_year(self): + year = 2020 + responses.add( + responses.GET, + f"https://www.pitt.edu/pittwire/news/features-articles?field_topics_target_id=432&field_article_date_value={year}" + "&title=&field_category_target_id=All", + body=self.university_news_features_articles_2020, + ) + + university_news_articles = news.get_articles_by_topic("university-news", year=year) + + self.assertEqual(len(university_news_articles), 5) + self.assertEqual( + university_news_articles[0], + news.Article( + title="University of Pittsburgh Library System acquires archive of renowned playwright August Wilson", + description="The late playwright and Pittsburgh native is best known for his unprecedented " + "American Century Cycle—10 plays that convey the Black experience in each decade of the 20th century. " + "All 10 of the plays", + url="https://www.pitt.edu/pittwire/features-articles/university-pittsburgh-library-system-acquires-archive-" + "renowned-playwright-august-wilson", + tags=["University News", "Arts and Humanities"], + ), + ) + self.assertEqual( + university_news_articles[-1], + news.Article( + title="Track and field Olympian reflects on time at Pitt and plans for new facilities", + description="Alumnus Herb Douglas (EDUC ’48, ’50G), the oldest living African American Olympic medalist, " + "says plans for new training spaces for athletes will bring recruiting and Pitt Athletics to new heights.", + url="https://www.pitt.edu/pittwire/features-articles/track-and-field-olympian-reflects-time-pitt-" + "plans-new-facilities", + tags=["University News", "Athletics"], + ), + ) + + @responses.activate + def test_get_articles_by_topic_less_than_one_page(self): + num_results = 5 + responses.add( + responses.GET, + "https://www.pitt.edu/pittwire/news/features-articles?field_topics_target_id=432&field_article_date_value=&title=" + "&field_category_target_id=All", + body=self.university_news_features_articles_page_0, + ) + + university_news_articles = news.get_articles_by_topic("university-news", max_num_results=num_results) + + self.assertEqual(len(university_news_articles), num_results) + self.assertEqual( + university_news_articles[0], + news.Article( + title="Questions for the ‘Connecting King’", + description="Vernard Alexander, the new director of Pitt’s Homewood Community Engagement Center, " + "sees himself as the ultimate connector.", + url="https://www.pitt.edu/pittwire/pittmagazine/features-articles/vernard-alexander-community-engagement", + tags=["University News", "Community Impact"], + ), + ) + self.assertEqual( + university_news_articles[-1], + news.Article( + title="Panthers Forward can now help graduates find loan forgiveness and repayment options", + description="Pitt’s innovative debt-relief program has partnered with Savi, " + "which can help some borrowers save thousands.", + url="https://www.pitt.edu/pittwire/features-articles/panthers-forward-savi-affordability", + tags=["University News", "Students"], + ), + ) + + @responses.activate + def test_get_articles_by_topic_multiple_pages(self): + num_results = news.NUM_ARTICLES_PER_PAGE + 5 + responses.add( + responses.GET, + "https://www.pitt.edu/pittwire/news/features-articles?field_topics_target_id=432&field_article_date_value=&title=" + "&field_category_target_id=All", + body=self.university_news_features_articles_page_0, + ) + responses.add( + responses.GET, + "https://www.pitt.edu/pittwire/news/features-articles?field_topics_target_id=432&field_article_date_value=&title=" + "&field_category_target_id=All&page=1", + body=self.university_news_features_articles_page_1, + ) + + university_news_articles = news.get_articles_by_topic("university-news", max_num_results=num_results) + + self.assertEqual(len(university_news_articles), num_results) + self.assertEqual( + university_news_articles[0], + news.Article( + title="Questions for the ‘Connecting King’", + description="Vernard Alexander, the new director of Pitt’s Homewood Community Engagement Center, " + "sees himself as the ultimate connector.", + url="https://www.pitt.edu/pittwire/pittmagazine/features-articles/vernard-alexander-community-engagement", + tags=["University News", "Community Impact"], + ), + ) + self.assertEqual( + university_news_articles[-1], + news.Article( + title="Pitt has 2 new Goldwater Scholars", + description="The prestigious scholarship is awarded to sophomores and juniors who plan to pursue " + "research careers in the sciences and engineering fields. Meet our winners.", + url="https://www.pitt.edu/pittwire/features-articles/goldwater-scholars-2024", + tags=[ + "University News", + "Technology & Science", + "David C. Frederick Honors College", + "Kenneth P. Dietrich School of Arts and Sciences", + ], + ), + ) diff --git a/tests/samples/news_university_news_features_articles_2020.html b/tests/samples/news_university_news_features_articles_2020.html new file mode 100644 index 0000000..e8566eb --- /dev/null +++ b/tests/samples/news_university_news_features_articles_2020.html @@ -0,0 +1,1241 @@ + + + + + + + + + + + + + + + + Pittwire News | University of Pittsburgh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + +
+
+
+
+
+ +
+
+ + +
+
+
+
+
+ + + + + + + + + + + +
+ +
+ +
+
+
+ + +
+
+ +
+
+
+

Filter By

+
+
+ +
+ + +
+ + + + + +
+
+ + +
+ +
+ +
+
+
+ +
+
+ + +
+
+ + Wilson standing in front of a wall papered with notebook pages + + + + + +
+

University of Pittsburgh Library System acquires archive of renowned playwright August Wilson +

+

+ The late playwright and Pittsburgh native is best known for his unprecedented American Century Cycle—10 plays that convey the Black experience in each decade of the 20th century. All 10 of the plays +

+ +
    +
  • + University News +
  • +
  • + Arts and Humanities +
  • +
+ +
+ + +
+
+ + The Cathedral of Learning towers over Pitt's campus + + + + + +
+

Pitt will offer more than 100 new flexible courses for 2020 +

+

+ From Afrofuturism in music to a new graduate certificate on transnational Asia, this academic year is set to offer students even more academic opportunities. +

+ +
    +
  • + Kenneth P. Dietrich School of Arts and Sciences +
  • +
  • + University News +
  • +
  • + Global +
  • +
  • + Faculty +
  • +
+ +
+ + +
+
+ + John Wallace addresses a crowd at a podium + + + + + +
+

John Wallace named vice provost for faculty diversity and development +

+

+ John Wallace, the David E. Epperson Endowed Chair in the School of Social Work, will serve as vice provost for faculty diversity and development beginning July 1, 2020. +

+ +
    +
  • + University News +
  • +
  • + Diversity, Equity, and Inclusion +
  • +
  • + School of Social Work +
  • +
+ +
+ + +
+
+ + + + + + + +
+

The University is again ranked a Best College for LGBTQ+ Students +

+

+ Here's a firsthand account of how one student found his place at Pitt. +

+ +
    +
  • + University News +
  • +
  • + Diversity, Equity, and Inclusion +
  • +
+ +
+ + +
+
+ + Douglas sits behind a desk wearing a grey suit + + + + + +
+

Track and field Olympian reflects on time at Pitt and plans for new facilities +

+

+ Alumnus Herb Douglas (EDUC ’48, ’50G), the oldest living African American Olympic medalist, says plans for new training spaces for athletes will bring recruiting and Pitt Athletics to new heights. +

+ +
    +
  • + University News +
  • +
  • + Athletics +
  • +
+ +
+ +
+
+ + +
+
+ +
+ +
+ +
+ +
+
+
+ + +
Trending
+ + + + + +
+ +
+
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/samples/news_university_news_features_articles_fulbright.html b/tests/samples/news_university_news_features_articles_fulbright.html new file mode 100644 index 0000000..9ba82ed --- /dev/null +++ b/tests/samples/news_university_news_features_articles_fulbright.html @@ -0,0 +1,1209 @@ + + + + + + + + + + + + + + + + Pittwire News | University of Pittsburgh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + +
+
+
+
+
+ +
+
+ + +
+
+
+
+
+ + + + + + + + + + + +
+ +
+ +
+
+
+ + +
+
+ +
+
+
+

Filter By

+
+
+ +
+ + +
+ + + + + +
+
+ + +
+ +
+ +
+
+
+ +
+
+ + +
+
+ + Blue and yellow dots on a world map + + + + + +
+

Meet Pitt’s 2024 faculty Fulbright winners +

+

+ The Fulbright U.S. Scholar Program offers faculty the opportunity to teach and conduct research abroad. +

+ +
    +
  • + University News +
  • +
  • + Innovation and Research +
  • +
  • + Global +
  • +
  • + Faculty +
  • +
+ +
+ + +
+
+ + the Cathedral of Learning commons room + + + + + +
+

10 Pitt students and alums are 2023-24 Fulbright winners +

+

+ The announcement comes a year after the University was named a top producer of U.S. recipients in 2022-23. +

+ +
    +
  • + University News +
  • +
  • + Global +
  • +
  • + Alumni +
  • +
  • + Students +
  • +
  • + University Center for International Studies (UCIS) +
  • +
  • + David C. Frederick Honors College +
  • +
  • + Kenneth P. Dietrich School of Arts and Sciences +
  • +
+ +
+ + +
+
+ + The Cathedral of Learning with Oakland in the background + + + + + +
+

Pitt has been named a top producer of Fulbright U.S. students for 2022-23 +

+

+ Meet the nine Pitt scholars in this year’s cohort. +

+ +
    +
  • + University News +
  • +
  • + Global +
  • +
  • + David C. Frederick Honors College +
  • +
  • + Kenneth P. Dietrich School of Arts and Sciences +
  • +
  • + School of Education +
  • +
  • + Swanson School of Engineering +
  • +
+ +
+ +
+
+ + +
+
+ +
+ +
+ +
+ +
+
+
+ + +
Trending
+ + + + + +
+ +
+
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/samples/news_university_news_features_articles_page_0.html b/tests/samples/news_university_news_features_articles_page_0.html new file mode 100644 index 0000000..4a3b608 --- /dev/null +++ b/tests/samples/news_university_news_features_articles_page_0.html @@ -0,0 +1,1755 @@ + + + + + + + + + + + + + + + + Pittwire News | University of Pittsburgh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + +
+
+
+
+
+ +
+
+ + +
+
+
+
+
+ + + + + + + + + + + +
+ +
+ +
+
+
+ + +
+
+ +
+
+
+

Filter By

+
+
+ +
+ + +
+ + + + + +
+
+ + +
+ +
+ +
+
+
+ +
+
+ + +
+
+ + Man with hands in pockets, standing in front of window. + + + + + +
+

Questions for the ‘Connecting King’ +

+

+ Vernard Alexander, the new director of Pitt’s Homewood Community Engagement Center, sees himself as the ultimate connector. +

+ +
    +
  • + University News +
  • +
  • + Community Impact +
  • +
+ +
+ + +
+
+ + Man speaks into handheld microphone. + + + + + +
+

The Pitt Alumni Association has a new president +

+

+ Bill Pierce believes in the power of Pitt pride. +

+ +
    +
  • + University News +
  • +
+ +
+ + +
+
+ + A Nazarbayev University School of Medicine graduating class + + + + + +
+

A Pitt partnership established this Kazakhstan medical school, which just earned its first MD accreditation +

+

+ Nazarbayev University School of Medicine is home to the only graduate-level MD program in Central Asia. +

+ +
    +
  • + University News +
  • +
  • + Global +
  • +
  • + Teaching & Learning +
  • +
  • + School of Medicine +
  • +
+ +
+ + +
+
+ + A panel of four people sit at a table with microphones + + + + + +
+

How Pitt is paving the way for transfer students +

+

+ A recent summit covered the challenges transfer students face when moving to four-year colleges — and highlighted Pitt programs that help smooth the transition. +

+ +
    +
  • + University News +
  • +
  • + Undergraduate students +
  • +
  • + Prospective students +
  • +
  • + School of Education +
  • +
+ +
+ + +
+
+ + Kayla Kendricks posing with graduation cords and a Panthers Forward stole + + + + + +
+

Panthers Forward can now help graduates find loan forgiveness and repayment options +

+

+ Pitt’s innovative debt-relief program has partnered with Savi, which can help some borrowers save thousands. +

+ +
    +
  • + University News +
  • +
  • + Students +
  • +
+ +
+ + +
+
+ + Pinkney + + + + + +
+

Dwayne Pinkney is Pitt’s new executive senior vice chancellor for administration and finance and CFO +

+

+ As executive senior vice chancellor for administration and finance, he will serve as a key advisor to Chancellor Gabel and University leadership. +

+ +
    +
  • + University News +
  • +
+ +
+ + +
+
+ + Portrait of Carla Panzella. + + + + + +
+

Carla Panzella is named Pitt's vice provost for student affairs +

+

+ She brings more than two decades of student-centered work to the role, effective June 1. +

+ +
    +
  • + University News +
  • +
  • + Students +
  • +
+ +
+ + +
+
+ + Michele V. Manuel + + + + + +
+

Michele V. Manuel is the first woman U. S. Steel Dean of the Swanson School of Engineering +

+

+ The award-winning materials engineer, innovator and leader joins Pitt from the University of Florida Sept. 1. +

+ +
    +
  • + University News +
  • +
  • + Technology & Science +
  • +
  • + Provost +
  • +
  • + Swanson School of Engineering +
  • +
+ +
+ + +
+
+ + Aiden Hulings + + + + + +
+

Pitt-Bradford earned its 14th consecutive Military Friendly designation +

+

+ The gold level school has been recognized for embracing military students and their families and dedicating resources to ensure their success. +

+ +
    +
  • + University News +
  • +
  • + Community Impact +
  • +
  • + Pitt-Bradford +
  • +
+ +
+ + +
+
+ + Four people walking outside on Pitt's campus + + + + + +
+

Pitt invited local high schoolers to experience the University’s disability resources firsthand +

+

+ The University for a Day event, May 6, included a campus tour, an information session featuring an alum and an admissions presentation. +

+ +
    +
  • + University News +
  • +
  • + Diversity, Equity, and Inclusion +
  • +
+ +
+ + +
+
+ + Zamani-Gallaher + + + + + +
+

Eboni Zamani-Gallaher is the new dean of Pitt’s School of Education +

+

+ Since she joined Pitt in 2022, the interim dean’s scholarship on equitable participation in higher ed has secured more than $10 million in funding. +

+ +
    +
  • + University News +
  • +
  • + Teaching & Learning +
  • +
  • + School of Education +
  • +
+ +
+ + +
+
+ + A beam is lifted to the top of a structure that is under construction + + + + + +
+

Pitt is updating its Campus Master Plan +

+

+ The Office of Planning, Design and Construction will lead the update, which will strengthen the University’s commitment to sustainability, community engagement and more. +

+ +
    +
  • + University News +
  • +
  • + Our City/Our Campus +
  • +
  • + Pittsburgh Campus +
  • +
+ +
+ + +
+
+ + Nguyen and Leslie + + + + + +
+

Hear from the graduates who earned this year’s top University honors +

+

+ Benjamin Leslie is this year’s Emma W. Locke awardee; the ODK Senior of the Year award goes to Joshua Nguyen. +

+ +
    +
  • + University News +
  • +
  • + Community Impact +
  • +
  • + Undergraduate students +
  • +
+ +
+ + +
+
+ + Graduates link arms after the ceremony + + + + + +
+

Spring commencement 2024, in photos +

+

+ See the most exciting moments from Sunday’s ceremony. +

+ +
    +
  • + University News +
  • +
  • + Students +
  • +
  • + Commencement +
  • +
+ +
+ + +
+
+ + ROC packs cereal into a United Way bag, held by a volunteer + + + + + +
+

This year’s United Way Campaign set University records +

+

+ David N. DeJong and other campaign leaders say it’s a testament to the power and impact of Pitt people. +

+ +
    +
  • + University News +
  • +
  • + Division of Philanthropic & Alumni Engagement +
  • +
+ +
+ + +
+
+ + A composite of Pitt winners with the American Academy of Arts and Sciences logo + + + + + +
+

Pitt has five new American Academy of Arts and Sciences members +

+

+ Among the University’s honorees are American Cancer Society researchers, an archaeologist and Chancellor Joan Gabel. +

+ +
    +
  • + University News +
  • +
  • + Innovation and Research +
  • +
  • + Faculty +
  • +
+ +
+ + +
+
+ + Groups of students walk by Schenley Plaza, with the Cathedral of Learning in the background + + + + + +
+

Catch up on the past year at Pitt with this tl;dr +

+

+ From new leadership to community engagement honors, the University redefined what is possible in 2023-24. +

+ +
    +
  • + University News +
  • +
+ +
+ + +
+
+ + A raised hand in a classroom + + + + + +
+

5 key takeaways from Pitt’s first Year of Discourse and Dialogue +

+

+ An April capstone event highlighted embracing differences and learning about the First Amendment as strategies to make difficult conversations easier. +

+ +
    +
  • + University News +
  • +
  • + Diversity, Equity, and Inclusion +
  • +
  • + Our City/Our Campus +
  • +
+ +
+ + +
+
+ + A line of people play horns with Pitt flags + + + + + +
+

Here are the speakers for Pitt’s graduate school commencement ceremonies +

+

+ Hear from alumni and pioneers leading the fields of infectious diseases, social work, entrepreneurship and more. +

+ +
    +
  • + University News +
  • +
  • + Graduate and professional students +
  • +
  • + Commencement +
  • +
+ +
+ + +
+
+ + John Surma in a gray suit + + + + + +
+

John Surma is Pitt’s 2024 spring commencement speaker +

+

+ The University will also honor the Board of Trustees member and former U. S. Steel CEO with an honorary degree. +

+ +
    +
  • + University News +
  • +
  • + Commencement +
  • +
+ +
+ +
+
+ + + + +
+
+ +
+ +
+ +
+ +
+
+
+ + +
Trending
+ + + + + +
+ +
+
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/samples/news_university_news_features_articles_page_1.html b/tests/samples/news_university_news_features_articles_page_1.html new file mode 100644 index 0000000..3eadecb --- /dev/null +++ b/tests/samples/news_university_news_features_articles_page_1.html @@ -0,0 +1,1743 @@ + + + + + + + + + + + + + + + + Pittwire News | University of Pittsburgh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + +
+
+
+
+
+ +
+
+ + +
+
+
+
+
+ + + + + + + + + + + +
+ +
+ +
+
+
+ + +
+
+ +
+
+
+

Filter By

+
+
+ +
+ + +
+ + + + + +
+
+ + +
+ +
+ +
+
+
+ +
+
+ + +
+
+ + Cestello puts a medallion around Gabel's neck + + + + + +
+

Joan Gabel installed as Pitt’s 19th chancellor +

+

+ Gabel praised Pitt’s 237-year legacy and its current momentum and expressed confidence in the institution’s future. +

+ +
    +
  • + University News +
  • +
  • + Chancellor +
  • +
+ +
+ + +
+
+ + A subject and professor look at brain scans on a monitor + + + + + +
+

Pitt’s Occupational Therapy program secures No. 1 spot in 2024 US News and World Report graduate school ranking +

+

+ And, five other programs earned top 10 distinctions on the annual list. +

+ +
    +
  • + University News +
  • +
  • + Teaching & Learning +
  • +
  • + School of Health and Rehabilitation Sciences +
  • +
+ +
+ + +
+
+ + A rendering of the future building on Fifth Avenue + + + + + +
+

A new home for Pitt’s School of Health and Rehabilitation Sciences will unite its programs and foster interdisciplinary opportunities +

+

+ The school will occupy six floors in the new building, set for December 2025 completion. +

+ +
    +
  • + University News +
  • +
  • + Our City/Our Campus +
  • +
  • + School of Health and Rehabilitation Sciences +
  • +
+ +
+ + +
+
+ + Blue and yellow dots on a world map + + + + + +
+

Meet Pitt’s 2024 faculty Fulbright winners +

+

+ The Fulbright U.S. Scholar Program offers faculty the opportunity to teach and conduct research abroad. +

+ +
    +
  • + University News +
  • +
  • + Innovation and Research +
  • +
  • + Global +
  • +
  • + Faculty +
  • +
+ +
+ + +
+
+ + The Cathedral of Learning behind magnolia blossoms + + + + + +
+

Pitt has 2 new Goldwater Scholars +

+

+ The prestigious scholarship is awarded to sophomores and juniors who plan to pursue research careers in the sciences and engineering fields. Meet our winners. +

+ +
    +
  • + University News +
  • +
  • + Technology & Science +
  • +
  • + David C. Frederick Honors College +
  • +
  • + Kenneth P. Dietrich School of Arts and Sciences +
  • +
+ +
+ + +
+
+ + A portrait of Gabel + + + + + +
+

Pitt Chancellor Joan Gabel is in pursuit of what’s possible +

+

+ Forward-thinking and values-driven, she’s embraced Pitt’s boundless potential throughout her first year as the University’s 19th leader. +

+ +
    +
  • + University News +
  • +
+ +
+ + +
+
+ + Bakken + + + + + +
+

Phil Bakken named Pitt’s vice chancellor and secretary of the Board of Trustees +

+

+ He currently serves as the chief of staff to the president and corporation secretary to the Board of Regents of the University of Nebraska System. +

+ +
    +
  • + University News +
  • +
  • + Community Impact +
  • +
+ +
+ + +
+
+ + Roc flexes next to a Top of the Cathedral medallion + + + + + +
+

No. 1 ROC finishes dominant run to win the first Pitt Madness +

+

+ The beloved mascot won each of his rounds with over 59% of the votes. Look back on his matchups throughout the month. +

+ +
    +
  • + University News +
  • +
  • + Our City/Our Campus +
  • +
  • + Pittsburgh Campus +
  • +
+ +
+ + +
+
+ + McCarthy + + + + + +
+

Joseph J. McCarthy named Pitt’s provost and senior vice chancellor +

+

+ He’s served the University for more than 25 years as both an award-winning faculty member and transformative leader. +

+ +
    +
  • + University News +
  • +
+ +
+ + +
+
+ + A group of students in blue Pitt Day of Giving shirts smile + + + + + +
+

A record-setting 11,400 alumni and donors raised $2.4 million on Pitt Day of Giving +

+

+ Across the globe, supporters helped fund University scholarships, research, academics, athletics and more. +

+ +
    +
  • + University News +
  • +
+ +
+ + +
+
+ + A professor gestures in front of students sitting in rows of desks + + + + + +
+

General Education Task Force aims to transform Pitt’s undergraduate experience +

+

+ The three-year project will streamline degree planning, reduce financial burdens and foster interdisciplinary exploration. +

+ +
    +
  • + University News +
  • +
  • + Teaching & Learning +
  • +
  • + Undergraduate students +
  • +
+ +
+ + +
+
+ + Delitto, Schneider and Shekhar in suits + + + + + +
+

Pitt launches a Doctor of Chiropractic program +

+

+ The evidence-based program will be the first of its kind in Pennsylvania and unique among research-intensive public institutions in the U.S. +

+ +
    +
  • + University News +
  • +
  • + Health and Wellness +
  • +
  • + School of Health and Rehabilitation Sciences +
  • +
+ +
+ + +
+
+ + A person uses tools on a small metal chip + + + + + +
+

Pitt ranks in top 20 for patents granted to universities worldwide +

+

+ Pitt innovators earned 114 U.S. patents in 2023. Learn how the Innovation Institute can help your invention make it to market. +

+ +
    +
  • + University News +
  • +
  • + Innovation and Research +
  • +
+ +
+ + +
+
+ + People hold up puzzle pieces to show a neon light that reads (hashtag) H 2 P + + + + + +
+

Share your Pitt story and make a gift during PDoG on Feb. 27 +

+

+ Gifts help ensure a brighter future for Pitt students for years to come. +

+ +
    +
  • + University News +
  • +
+ +
+ + +
+
+ + A drone shot fades from Pitt's campus on a snowy day to a sunny day + + + + + +
+

Turn your winter from gray to green with these sustainable activities +

+

+ Plus, here’s how Pitt reduced emissions and diverted a record number of donations from landfills. +

+ +
    +
  • + University News +
  • +
  • + Sustainability +
  • +
+ +
+ + +
+
+ + People sit around a table in a room with stained glass windows + + + + + +
+

Here’s who won the University’s annual social justice awards +

+

+ The students and staff who make Pitt more just, equitable and inclusive will be recognized during a Jan. 26 luncheon. +

+ +
    +
  • + University News +
  • +
  • + Community Impact +
  • +
  • + Diversity, Equity, and Inclusion +
  • +
+ +
+ + +
+
+ + Sastry + + + + + +
+

Hari Sastry is stepping down as Pitt’s chief financial officer +

+

+ He’s headed to Georgetown University after a five-year stint at Pitt that included record research funding, increased transparency in the budget process and a focus on diverse supplier initiatives. +

+ +
    +
  • + University News +
  • +
  • + Staff +
  • +
+ +
+ + +
+
+ + An older woman stands in front of a photo of her younger self on a screen + + + + + +
+

This CGS alumna helped bring honor to nontraditional students +

+

+ The 50th anniversary exhibit of honor society recalls outreach to part-time and nontraditional students. +

+ +
    +
  • + University News +
  • +
  • + Alumni +
  • +
+ +
+ + +
+
+ + Loftus speaks at a Pitt press conference + + + + + +
+

University of Pittsburgh Police Department Chief James Loftus retires +

+

+ Loftus steps down after more than 10 years of service to Pitt. Deputy Chief Holly Lamb will be promoted to chief of police. +

+ +
    +
  • + University News +
  • +
  • + Staff +
  • +
+ +
+ + +
+
+ + Graduates dance in celebration as confetti falls + + + + + +
+

Winter Commencement 2024 in photos +

+

+ See the gallery celebrating nearly 700 Pitt graduates who crossed the stage on Dec. 17. +

+ +
    +
  • + University News +
  • +
  • + Students +
  • +
  • + Commencement +
  • +
+ +
+ +
+
+ + + + +
+
+ +
+ +
+ +
+ +
+
+
+ + +
Trending
+ + + + + +
+ +
+
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +