From f02d80e1417d1b0c6f182f2f18255fbb9e55d49c Mon Sep 17 00:00:00 2001 From: Joseph Date: Mon, 24 May 2021 19:46:07 +0000 Subject: [PATCH] [FirefoxAddonsBridge] Fix download link extraction (#2120) --- bridges/FirefoxAddonsBridge.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bridges/FirefoxAddonsBridge.php b/bridges/FirefoxAddonsBridge.php index decb30b759b..23a381c1da2 100644 --- a/bridges/FirefoxAddonsBridge.php +++ b/bridges/FirefoxAddonsBridge.php @@ -41,23 +41,24 @@ public function collectData() { $this->feedName = $html->find('h1[class="AddonTitle"] > a', 0)->innertext; $author = $html->find('span.AddonTitle-author > a', 0)->plaintext; - foreach ($html->find('div.AddonVersionCard-content') as $div) { + foreach ($html->find('li.AddonVersionCard') as $li) { $item = array(); - $item['title'] = $div->find('h2.AddonVersionCard-version', 0)->plaintext; + $item['title'] = $li->find('h2.AddonVersionCard-version', 0)->plaintext; + $item['title'] = $li->find('h2.AddonVersionCard-version', 0)->plaintext; $item['uid'] = $item['title']; $item['uri'] = $this->getURI(); $item['author'] = $author; - if (preg_match($this->releaseDateRegex, $div->find('div.AddonVersionCard-fileInfo', 0)->plaintext, $match)) { + if (preg_match($this->releaseDateRegex, $li->find('div.AddonVersionCard-fileInfo', 0)->plaintext, $match)) { $item['timestamp'] = $match[1]; $size = $match[2]; } - $compatibility = $div->find('div.AddonVersionCard-compatibility', 0)->plaintext; - $license = $div->find('p.AddonVersionCard-license', 0)->innertext; - $downloadlink = $div->find('a.InstallButtonWrapper-download-link', 0)->href; - $releaseNotes = $this->removeOutgoinglink($div->find('div.AddonVersionCard-releaseNotes', 0)); + $compatibility = $li->find('div.AddonVersionCard-compatibility', 0)->plaintext; + $license = $li->find('p.AddonVersionCard-license', 0)->innertext; + $downloadlink = $li->find('a.InstallButtonWrapper-download-link', 0)->href; + $releaseNotes = $this->removeOutgoinglink($li->find('div.AddonVersionCard-releaseNotes', 0)); if (preg_match($this->xpiFileRegex, $downloadlink, $match)) { $xpiFilename = $match[0];