From 200b77c163b751a7f5864da7c559ee80abe94f95 Mon Sep 17 00:00:00 2001 From: Quentin Dequippe Date: Mon, 25 May 2026 11:19:27 +0200 Subject: [PATCH 1/2] fix: local time --- .env | 4 ---- README.md | 9 --------- composer.json | 3 +++ .../Meetup/MeetupComMeetupFactory.php | 20 +++++++++---------- src/MeetupCom/MeetupComCrawler.php | 20 ++++++++++++++++++- 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/.env b/.env index 9e92c67c8..edffca04a 100644 --- a/.env +++ b/.env @@ -3,7 +3,3 @@ APP_ENV=dev APP_DEBUG=1 APP_SECRET=67d829bf61dc5f87a73fd814e2c9f622 ###< symfony/framework-bundle ### - -# meetup.com api - from https://www.meetup.com/api/oauth/list/ - complete in .env.local -MEETUP_COM_OAUTH_KEY= -MEETUP_COM_OAUTH_SECRET= diff --git a/README.md b/README.md index 282088913..1fad498ba 100644 --- a/README.md +++ b/README.md @@ -19,15 +19,6 @@ cd friendsofphp.org composer install ``` -- Copy `.env` to `.env.local` -- Add your [Meetup.com API keys](https://secure.meetup.com/meetup_api/oauth_consumers/): - -```dotenv -# .env.local -MEETUP_COM_OAUTH_KEY=... -MEETUP_COM_OAUTH_SECRET=... -``` - - Update Meetup Data ```bash diff --git a/composer.json b/composer.json index f494c16b5..8f93b6ef7 100644 --- a/composer.json +++ b/composer.json @@ -62,6 +62,9 @@ "sort-packages": true, "allow-plugins": { "phpstan/extension-installer": true + }, + "platform": { + "php": "8.3" } }, "minimum-stability": "dev", diff --git a/src/MeetupCom/Meetup/MeetupComMeetupFactory.php b/src/MeetupCom/Meetup/MeetupComMeetupFactory.php index 5154dd66e..da737646e 100644 --- a/src/MeetupCom/Meetup/MeetupComMeetupFactory.php +++ b/src/MeetupCom/Meetup/MeetupComMeetupFactory.php @@ -51,16 +51,16 @@ public function createFromData(array $data): ?Meetup $dateTimeImmutable = new DateTimeImmutable($data['startDate']); return new Meetup( - $name, - html_entity_decode((string) $data[self::GROUP][self::NAME]), - $dateTimeImmutable->setTimezone(new DateTimeZone('UTC')), - $dateTimeImmutable->format('Y-m-d'), - $dateTimeImmutable->format('H:i'), - $data['url'], - $location->getCity(), - $location->getCountry(), - $location->getCoordinateLatitude(), - $location->getCoordinateLongitude(), + name: $name, + userGroupName: html_entity_decode((string) $data[self::GROUP][self::NAME]), + utcStartDateTime: $dateTimeImmutable->setTimezone(new DateTimeZone('UTC')), + localDate: $dateTimeImmutable->format('Y-m-d'), + localTime: $dateTimeImmutable->format('H:i'), + url: $data['url'], + city: $location->getCity(), + country: $location->getCountry(), + latitude: $location->getCoordinateLatitude(), + longitude: $location->getCoordinateLongitude(), ); } diff --git a/src/MeetupCom/MeetupComCrawler.php b/src/MeetupCom/MeetupComCrawler.php index faab002d1..2af4d3ff2 100644 --- a/src/MeetupCom/MeetupComCrawler.php +++ b/src/MeetupCom/MeetupComCrawler.php @@ -39,6 +39,10 @@ public function getMeetupsByGroupSlug(string $groupSlug): array continue; } + if (! isset($schema['url'])) { + continue; + } + if (! isset($schema['organizer']['url'])) { continue; } @@ -47,7 +51,21 @@ public function getMeetupsByGroupSlug(string $groupSlug): array continue; } - $data[] = $schema; + $crawler = $this->httpBrowser->request('GET', $schema['url']); + $innerStructuredDataElements = $crawler->filter('script[type="application/ld+json"]'); + + foreach ($innerStructuredDataElements as $innerStructuredDataElement) { + $innerSchema = Json::decode($innerStructuredDataElement->textContent, Json::FORCE_ARRAY); + if (! isset($innerSchema['@type'])) { + continue; + } + + if ($innerSchema['@type'] !== 'Event') { + continue; + } + + $data[] = $innerSchema; + } } } From bbe4d29397407575c0db5f25722654519b86a5d9 Mon Sep 17 00:00:00 2001 From: Quentin Dequippe Date: Mon, 25 May 2026 11:23:57 +0200 Subject: [PATCH 2/2] fix test --- .github/workflows/rector.yaml | 2 -- tests/MeetupCom/MeetupComCrawlerTest.php | 5 +++-- tests/MeetupCom/fixtures/meetup_detail.html | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 tests/MeetupCom/fixtures/meetup_detail.html diff --git a/.github/workflows/rector.yaml b/.github/workflows/rector.yaml index 1fa057be6..d21fa25dd 100644 --- a/.github/workflows/rector.yaml +++ b/.github/workflows/rector.yaml @@ -12,8 +12,6 @@ jobs: steps: - uses: actions/checkout@v6 - with: - token: ${{ secrets.ACCESS_TOKEN || github.token }} - uses: shivammathur/setup-php@v2 with: diff --git a/tests/MeetupCom/MeetupComCrawlerTest.php b/tests/MeetupCom/MeetupComCrawlerTest.php index ac7aef660..1f486358b 100644 --- a/tests/MeetupCom/MeetupComCrawlerTest.php +++ b/tests/MeetupCom/MeetupComCrawlerTest.php @@ -17,8 +17,9 @@ public function testGetMeetupsByGroupSlug(): void { // Arrange $smartFileSystem = new SmartFileSystem(); - $mockResponse = new MockResponse($smartFileSystem->readFile(__DIR__ . '/fixtures/meetup_events.html')); - $mockHttpClient = new MockHttpClient([$mockResponse]); + $mockResponseList = new MockResponse($smartFileSystem->readFile(__DIR__ . '/fixtures/meetup_events.html')); + $mockResponseDetail = new MockResponse($smartFileSystem->readFile(__DIR__ . '/fixtures/meetup_detail.html')); + $mockHttpClient = new MockHttpClient([$mockResponseList, $mockResponseDetail]); $httpBrowser = new HttpBrowser($mockHttpClient); $meetupComCrawler = new MeetupComCrawler($httpBrowser); diff --git a/tests/MeetupCom/fixtures/meetup_detail.html b/tests/MeetupCom/fixtures/meetup_detail.html new file mode 100644 index 000000000..7a92e5547 --- /dev/null +++ b/tests/MeetupCom/fixtures/meetup_detail.html @@ -0,0 +1,19 @@ +"Xdebug gonna give it to ya" & "Upgrade your Symfony app with Rector", Do., 19. Jan. 2023, 18:45 | Meetup
Zum Inhalt springen

Details

Hallo Symfony-Freunde,

+

Wir freuen uns, euch zu unserem nächsten Meetup begrüßen zu dürfen und noch viel mehr freuen wir uns unsere beiden Talks von Conrad Barthelmes und Oliver Kossin.

+

Zeitplan:

+

18:45 Uhr: Ankommen und Get-Together
+19:00 Uhr: Intro
+19:10 Uhr: Conrad Barthelmes "Xdebug gonna give it to ya"
+19:50 Uhr Small Break
+20:00 Uhr: Oliver Kossin "Upgrade your Symfony app with Rector"
+20:40 Uhr: Socialising

+

Für Essen und Getränke wird gesorgt.
+Wir freuen uns auf euch!

+

Euer QOSSMIC Team

+

Während der Veranstaltung werden Fotos & Videos aufgenommen, von denen eine Auswahl im Internet veröffentlicht wird. Wenn du zu dieser Veranstaltung erscheinst, stimmst du zu, dass Aufnahmen von deiner Person gemacht und im Internet veröffentlicht werden.

Verwandte Themen

PHP
Symfony

Sponsoren

OPEN Digitalgruppe

OPEN Digitalgruppe

Organizing Symfony User Groups, live & online events since 2011

OPEN Software Consulting

OPEN Software Consulting

Speaker, Talks, Hilfest. für Personen, die zum 1. Mal einen Talk halten

Das könnte dir auch gefallen

\ No newline at end of file