Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AssociatedPressNewsBridge] Add bridge #1475

Merged
merged 42 commits into from
Apr 5, 2022
Merged

[AssociatedPressNewsBridge] Add bridge #1475

merged 42 commits into from
Apr 5, 2022

Conversation

VerifiedJoseph
Copy link
Contributor

Adds bridge for Associated Press website. Closes #1463

@VerifiedJoseph VerifiedJoseph marked this pull request as ready for review March 3, 2020 16:41
@VerifiedJoseph VerifiedJoseph changed the title [WIP][AssociatedPressNewsBridge] Add bridge [AssociatedPressNewsBridge] Add bridge Mar 3, 2020
@somini
Copy link
Contributor

somini commented Mar 18, 2020

LGTM, a very complete bridge.

@somini somini mentioned this pull request Jun 24, 2020
10 tasks
@csisoap
Copy link
Contributor

csisoap commented May 17, 2021

There's a bug on this article that add an image that don't exist
image
image
Link: https://apnews.com/ea1e82af5cbabf1022e8590d6111d196

Raw data from API about that article:

{
      "id": "urn:publicid:ap.org:ea1e82af5cbabf1022e8590d6111d196",
      "shortId": "urn:publicid:ap.org:ea1e82af5cbabf1022e8590d6111d196",
      "allowAd": false,
      "borderColor": null,
      "brackets": null,
      "bracketsSettings": null,
      "cardTitle": null,
      "cardHeadline": null,
      "cardType": "Wire Story",
      "collectionTagObjs": null,
      "contents": [
        {
          "id": "urn:publicid:ap.org:ea1e82af5cbabf1022e8590d6111d196",
          "shortId": "ea1e82af5cbabf1022e8590d6111d196",
          "bylines": "The Associated Press",
          "contentType": "text",
          "disableConnatix": false,
          "downloadSettings": {
            
          },
          "embedCaption": null,
          "embedHeight": null,
          "embedHTML": null,
          "embedLinkURL": null,
          "firstWords": "<p>NEW YORK (AP) — Board members at Microsoft Corp. made a decision in 2020 that it wasn't appropriate for its co-founder Bill Gates to continue sitting on its board as they investigated the billionaire’s prior romantic relationship with a female Microsoft employee that was deemed inappropriate, according to a report in The Wall Street Journal.</p>",
          "hasTextOverlay": false,
          "headline": "Report: Microsoft investigated Gates before he left board",
          "description": null,
          "interactiveLinkUrl": null,
          "interactiveLinkUrlText": null,
          "language": "en",
          "leadPhotoId": null,
          "leadVideoId": null,
          "localLinkUrl": "https://apnews.com/ea1e82af5cbabf1022e8590d6111d196",
          "localMemberName": null,
          "media": [
            
          ],
          "audioMedia": [
            
          ],
          "mediumIds": [
            
          ],
          "mediaCount": 0,
          "published": "2021-05-17 00:33:11",
          "tagObjs": [
            {
              "id": "MicrosoftCorp",
              "name": "Microsoft Corp",
              "canonicalName": "microsoft-corp",
              "isPr": false
            },
            {
              "id": "BillGates",
              "name": "Bill Gates",
              "canonicalName": "bill-gates",
              "isPr": false
            },
            {
              "id": "Philanthropy",
              "name": "Philanthropy",
              "canonicalName": "philanthropy",
              "isPr": false
            },
            {
              "id": "apf-technology",
              "name": "Technology",
              "canonicalName": "technology",
              "isPr": false
            },
            {
              "id": "apf-business",
              "name": "Business",
              "canonicalName": "business",
              "isPr": false
            }
          ],
          "updated": "2021-05-17 01:08:49",
          "tagIds": [
            "MicrosoftCorp",
            "BillGates",
            "Philanthropy",
            "apf-technology",
            "apf-business",
            "apf-GeneralNews"
          ],
          "title": "US--Gates-Divorce",
          "contentSponsor": null,
          "layoutType": "Text",
          "stackedStory": true,
          "notificationId": null,
          "richEmbeds": [
            
          ],
          "sponsored": false,
          "embedRatio": null,
          "embedType": null,
          "pullQuoteObjs": [
            
          ],
          "dateline": null,
          "leadVideoAutoEmbed": false,
          "flattenedFirstWords": "NEW YORK (AP) — Board members at Microsoft Corp. made a decision in 2020 that it wasn't appropriate for its co-founder Bill Gates to continue sitting on its board as they investigated the billionai...",
          "isTpContent": false,
          "socialEmbeds": [
            
          ],
          "isPrContent": false,
          "storyHTML": "<p>NEW YORK (AP) — Board members at Microsoft Corp. made a decision in 2020 that it wasn't appropriate for its co-founder Bill Gates to continue sitting on its board as they investigated the billionaire’s prior romantic relationship with a female Microsoft employee that was deemed inappropriate, according to a report in The Wall Street Journal.</p><p>Citing unnamed sources, The Journal reported online Sunday that board members looking into the matter hired a law firm in late 2019 to conduct an investigation after a Microsoft engineer alleged in a letter that she had a sexual relationship with Gates over several years. </p><p>The Journal reported that Gates resigned before the board's investigation was finished, citing another person familiar with the matter.</p><p>An unnamed spokeswoman for Gates acknowledged to The Journal that there was an affair almost 20 years ago, and that it ended “amicably.\" The spokesperson told The Journal that “his decision to transition off the board was in no way related to this matter.\"\" </p><div class=\"ad-placeholder\"></div><p>When he left Microsoft's board last year, Gates said he was stepping down to focus on philanthropy. </p><p>In an email sent to The Associated Press late Sunday, Microsoft said that it “received a concern in the latter half of 2019 that Bill Gates sought to initiate an intimate relationship with a company employee in the year 2000. A committee of the Board reviewed the concern, aided by an outside law firm, to conduct a thorough investigation. Throughout the investigation, Microsoft provided extensive support to the employee who raised the concern.”</p><p>Earlier this month, Bill and Melinda Gates announced that they were divorcing after 27 years of marriage but would keep working together at the Bill and Melinda Gates Foundation, one of the largest charitable foundations in the world. Gates was formerly the world’s richest person and his fortune is estimated at well over $100 billion. </p><p>Earlier Sunday, The New York Times reported that Gates had developed “a reputation for questionable conduct in work-related settings.\"</p><p>The Times reported that on at least a few occasions, Gates made overtures to women who worked for him at Microsoft and the Bill and Melinda Gates Foundation. The Times cited people with direct knowledge of his behavior.</p>",
          "alertLinkDateTime": null,
          "storyLayout": {
            
          },
          "reporters": [
            
          ],
          "headlinePlacement": null,
          "relatedStoryEmbeds": [
            
          ],
          "disableNativo": false,
          "canonicalUrl": "philanthropy-technology-business"
        }
      ],
      "disclaimerText": null,
      "dividerColor": null,
      "expandedStoryCount": null,
      "feed": [
        
      ],
      "headlineWidget": false,
      "hubPeekLinkText": null,
      "hubPeekTagId": null,
      "hubPeekTagName": null,
      "hubPeekCanonicalName": null,
      "hubPeekIsPr": null,
      "minimizedStoryCount": null,
      "tagObjs": [
        {
          "id": "apf-business",
          "name": "Business",
          "canonicalName": "business",
          "isPr": false
        },
        {
          "id": "apf-technology",
          "name": "Technology",
          "canonicalName": "technology",
          "isPr": false
        },
        {
          "id": "apf-topnews",
          "name": "AP Top News",
          "canonicalName": "ap-top-news",
          "isPr": false
        },
        {
          "id": "Philanthropy",
          "name": "Philanthropy",
          "canonicalName": "philanthropy",
          "isPr": false
        },
        {
          "id": "BillGates",
          "name": "Bill Gates",
          "canonicalName": "bill-gates",
          "isPr": false
        },
        {
          "id": "MicrosoftCorp",
          "name": "Microsoft Corp",
          "canonicalName": "microsoft-corp",
          "isPr": false
        }
      ],
      "textColor": null,
      "layoutType": null,
      "customLayoutType": null,
      "endDateTime": null,
      "teamLimit": 25,
      "notificationUrl": null,
      "notificationText": null,
      "notificationTitle": null,
      "notificationType": null,
      "notificationUpdated": null
    },

@VerifiedJoseph
Copy link
Contributor Author

VerifiedJoseph commented May 26, 2021

There's a bug on this article that add an image that don't exist
image
image
Link: https://apnews.com/ea1e82af5cbabf1022e8590d6111d196
[..]

@csisoap, I've pushed commits that fix this and a few other issues.

@csisoap
Copy link
Contributor

csisoap commented May 27, 2021

Awesome, thank.

@csisoap
Copy link
Contributor

csisoap commented Jun 6, 2021

It seems AP is changing stuff.

'International News' is return blank page. AP now uses apf-WorldNews instead of apf-intlnews.

Also, sometimes the feed can't working due to error
image

Two PHP warning in my log:
PHP Notice: Trying to access array offset on value of type null in /app/bridges/AssociatedPressNewsBridge.php on line 87
PHP Notice: Undefined offset: 0 in /app/bridges/AssociatedPressNewsBridge.php on line 87

EDIT: Can't use image attachment on the Video section. I got AccessDenied

@VerifiedJoseph
Copy link
Contributor Author

VerifiedJoseph commented Jun 7, 2021

.@csisoap, I've pushed commits to fix these issues.

@csisoap
Copy link
Contributor

csisoap commented Jun 8, 2021

@VerifiedJoseph the error is happening again.

I try look into the API data and discover this cause error.

{
      "id": "urn:publicid:ap.org:3414dd359592d5c0fec811870990106a",
      "shortId": "urn:publicid:ap.org:3414dd359592d5c0fec811870990106a",
      "allowAd": null,
      "borderColor": null,
      "brackets": null,
      "bracketsSettings": null,
      "cardTitle": "Breaking News",
      "cardHeadline": null,
      "cardType": "Notification",
      "collectionTagObjs": null,
      "contents": [
        
      ],
      "disclaimerText": null,
      "dividerColor": "#000000",
      "expandedStoryCount": null,
      "feed": [
        
      ],
      "headlineWidget": null,
      "hubPeekLinkText": null,
      "hubPeekTagId": null,
      "hubPeekTagName": null,
      "hubPeekCanonicalName": null,
      "hubPeekIsPr": null,
      "minimizedStoryCount": null,
      "tagObjs": [
        {
          "id": "apf-ApNewsAlert",
          "name": "Ap News Alert",
          "canonicalName": "ap-news-alert",
          "isPr": false
        },
        {
          "id": "Governmentandpolitics",
          "name": "Government and politics",
          "canonicalName": "government-and-politics",
          "isPr": false
        }
      ],
      "textColor": "#000000",
      "layoutType": "null",
      "customLayoutType": "null",
      "endDateTime": "2021-06-08 10:15:00",
      "teamLimit": 25,
      "notificationUrl": "https://apnews.com/article/donald-trump-capitol-siege-government-and-politics-96054d62518a7be4c3f30231f51beaf5",
      "notificationText": "First bipartisan report on Jan. 6 attack at Capitol finds broad failures of government, military and law enforcement",
      "notificationTitle": null,
      "notificationType": {
        "notificationTitle": "Breaking News",
        "colorHex": "#ff322e",
        "id": "1"
      },
      "notificationUpdated": "2021-06-08 09:18:27"
    },

I think those article items have their cardType as "Wire Story".

@csisoap
Copy link
Contributor

csisoap commented Jun 8, 2021

I see you have pushed commit. Thank you

@dvikan
Copy link
Contributor

dvikan commented Mar 22, 2022

Is this PR still relevant?

@somini
Copy link
Contributor

somini commented Mar 23, 2022

Is this PR still relevant?

Yes, but it needs a rebase, or the site changed the format.

@Bockiii
Copy link
Contributor

Bockiii commented Mar 24, 2022

First context seems to work fine, second has an issue:

[Bridge returned error 400! (19075)]
2022-03-24 21:17:06
Associated Press News Bridge was unable to receive or process the remote website's content!
Error message: `Mixed context parameters`
Query string: `action=display&bridge=AssociatedPressNews&format=Html&topic=europe`

@VerifiedJoseph
Copy link
Contributor Author

Your query string is missing the context parameter. Should be like: action=display&bridge=AssociatedPressNews&format=Html&context=Custom+Topic&topic=europe.

@Bockiii
Copy link
Contributor

Bockiii commented Mar 25, 2022

Hi,

Yeah, I saw that. It's interesting, this has never been an issue before. The output was from my automated testing, just using the bridgelist to generate the context will do it. But it's interesting that I've never seen this before... All other bridges do not care if the context is not provided as a parameter because they derive the context within the bridge.

Not saying it's bad, its just different.

Couldnt look into the bridge detail yet, will do so soon

@dvikan
Copy link
Contributor

dvikan commented Mar 29, 2022

Tested and works. Can you add a limit option?

@Bockiii
Copy link
Contributor

Bockiii commented Apr 5, 2022

Pull request artifacts

file last change
AssociatedPressNews-pr-context1 2022-04-05, 11:52:40
AssociatedPressNews-pr-context2 2022-04-05, 11:52:40

@Bockiii
Copy link
Contributor

Bockiii commented Apr 5, 2022

This works fine. The limit is at 15, so I think its a good limit for the amount of updates.

LGTM, merging

@Bockiii Bockiii merged commit 8f93149 into RSS-Bridge:master Apr 5, 2022
Kwbmm pushed a commit to Kwbmm/rss-bridge that referenced this pull request Jun 17, 2022
@VerifiedJoseph VerifiedJoseph deleted the ApNewsBridge branch July 5, 2022 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bridge request for AP news
5 participants