Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
floviolleau committed Aug 16, 2023
2 parents 6ab3a5f + a1237d9 commit 5cf7df5
Show file tree
Hide file tree
Showing 21 changed files with 986 additions and 102 deletions.
2 changes: 2 additions & 0 deletions bridges/BadDragonBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public function detectParameters($url)
// Sale
$regex = '/^(https?:\/\/)?bad-dragon\.com\/sales/';
if (preg_match($regex, $url, $matches) > 0) {
$params['context'] = 'Sales';
return $params;
}

Expand Down Expand Up @@ -192,6 +193,7 @@ public function detectParameters($url)
isset($urlParams['noAccessories'])
&& $urlParams['noAccessories'] === '1'
&& $params['noAccessories'] = 'on';
$params['context'] = 'Clearance';

return $params;
}
Expand Down
3 changes: 3 additions & 0 deletions bridges/BandcampBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,20 +397,23 @@ public function detectParameters($url)
// By tag
$regex = '/^(https?:\/\/)?bandcamp\.com\/tag\/([^\/.&?\n]+)/';
if (preg_match($regex, $url, $matches) > 0) {
$params['context'] = 'By tag';
$params['tag'] = urldecode($matches[2]);
return $params;
}

// By band
$regex = '/^(https?:\/\/)?([^\/.&?\n]+?)\.bandcamp\.com/';
if (preg_match($regex, $url, $matches) > 0) {
$params['context'] = 'By band';
$params['band'] = urldecode($matches[2]);
return $params;
}

// By album
$regex = '/^(https?:\/\/)?([^\/.&?\n]+?)\.bandcamp\.com\/album\/([^\/.&?\n]+)/';
if (preg_match($regex, $url, $matches) > 0) {
$params['context'] = 'By album';
$params['band'] = urldecode($matches[2]);
$params['album'] = urldecode($matches[3]);
return $params;
Expand Down
20 changes: 17 additions & 3 deletions bridges/CodebergBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,12 @@ private function extractIssues($html)

$item['title'] = $li->find('a.title', 0)->plaintext . ' (' . $number . ')';
$item['uri'] = $li->find('a.title', 0)->href;
$item['timestamp'] = $li->find('span.time-since', 0)->title;

$time = $li->find('relative-time.time-since', 0);
if ($time) {
$item['timestamp'] = $time->datetime;
}

$item['author'] = $li->find('div.desc', 0)->find('a', 1)->plaintext;

// Fetch issue page
Expand Down Expand Up @@ -270,14 +275,23 @@ private function extractPulls($html)

$item['title'] = $li->find('a.title', 0)->plaintext . ' (' . $number . ')';
$item['uri'] = $li->find('a.title', 0)->href;
$item['timestamp'] = $li->find('span.time-since', 0)->title;

$time = $li->find('relative-time.time-since', 0);
if ($time) {
$item['timestamp'] = $time->datetime;
}

$item['author'] = $li->find('div.desc', 0)->find('a', 1)->plaintext;

// Fetch pull request page
$pullRequestPage = getSimpleHTMLDOMCached($item['uri'], 3600);
$pullRequestPage = defaultLinkTo($pullRequestPage, self::URI);

$item['content'] = $pullRequestPage->find('ui.timeline', 0)->find('div.render-content.markup', 0);
$var = $pullRequestPage->find('ui.timeline', 0);
if ($var) {
$var1 = $var->find('div.render-content.markup', 0);
$item['content'] = $var1;
}

foreach ($li->find('a.ui.label') as $label) {
$item['categories'][] = $label->plaintext;
Expand Down
3 changes: 3 additions & 0 deletions bridges/FacebookBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ public function detectParameters($url)
// By profile
$regex = '/^(https?:\/\/)?(www\.)?facebook\.com\/profile\.php\?id\=([^\/?&\n]+)?(.*)/';
if (preg_match($regex, $url, $matches) > 0) {
$params['context'] = 'User';
$params['u'] = urldecode($matches[3]);
return $params;
}

// By group
$regex = '/^(https?:\/\/)?(www\.)?facebook\.com\/groups\/([^\/?\n]+)?(.*)/';
if (preg_match($regex, $url, $matches) > 0) {
$params['context'] = 'Group';
$params['g'] = urldecode($matches[3]);
return $params;
}
Expand All @@ -103,6 +105,7 @@ public function detectParameters($url)
$regex = '/^(https?:\/\/)?(www\.)?facebook\.com\/([^\/?\n]+)/';

if (preg_match($regex, $url, $matches) > 0) {
$params['context'] = '';
$params['u'] = urldecode($matches[3]);
return $params;
}
Expand Down
139 changes: 70 additions & 69 deletions bridges/FreeTelechargerBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,89 +2,90 @@

class FreeTelechargerBridge extends BridgeAbstract
{
const NAME = 'Free-Telecharger';
const URI = 'https://www.free-telecharger.live/';
const DESCRIPTION = 'Suivi de série sur Free-Telecharger';
const MAINTAINER = 'sysadminstory';
const PARAMETERS = [
'Suivi de publication de série' => [
'url' => [
'name' => 'URL de la série',
'type' => 'text',
'required' => true,
'title' => 'URL d\'une série sans le https://www.free-telecharger.live/',
'pattern' => 'series.*\.html',
'exampleValue' => 'series-vf-hd/145458-the-last-of-us-saison-1-web-dl-720p.html'
],
]
];
const CACHE_TIMEOUT = 3600;
public function collectData()
{
$html = getSimpleHTMLDOM(self::URI . $this->getInput('url'));
const NAME = 'Free-Telecharger';
const URI = 'https://www.free-telecharger.live/';
const DESCRIPTION = 'Suivi de série sur Free-Telecharger';
const MAINTAINER = 'sysadminstory';
const PARAMETERS = [
'Suivi de publication de série' => [
'url' => [
'name' => 'URL de la série',
'type' => 'text',
'required' => true,
'title' => 'URL d\'une série sans le https://www.free-telecharger.live/',
'pattern' => 'series.*\.html',
'exampleValue' => 'series-vf-hd/145458-the-last-of-us-saison-1-web-dl-720p.html'
],
]
];
const CACHE_TIMEOUT = 3600;
public function collectData()
{
$html = getSimpleHTMLDOM(self::URI . $this->getInput('url'));

// Find all block content of the page
$blocks = $html->find('div[class=block1]');
// Find all block content of the page
$blocks = $html->find('div[class=block1]');

// Global Infos block
$infosBlock = $blocks[0];
// Links block
$linksBlock = $blocks[2];
// Global Infos block
$infosBlock = $blocks[0];
// Links block
$linksBlock = $blocks[2];

// Extract Global Show infos
$this->showTitle = trim($infosBlock->find('div[class=titre1]', 0)->find('font', 0)->plaintext);
$this->showTechDetails = trim($infosBlock->find('div[align=center]', 0)->find('b', 0)->plaintext);
// Extract Global Show infos
$this->showTitle = trim($infosBlock->find('div[class=titre1]', 0)->find('font', 0)->plaintext);
$this->showTechDetails = trim($infosBlock->find('div[align=center]', 0)->find('b', 0)->plaintext);



// Get Episodes names and links
$episodes = $linksBlock->find('div[id=link]', 0)->find('font[color=#ff6600]');
$links = $linksBlock->find('div[id=link]', 0)->find('a');
// Get Episodes names and links
$episodes = $linksBlock->find('div[id=link]', 0)->find('font[color=#ff6600]');
$links = $linksBlock->find('div[id=link]', 0)->find('a');

foreach ($episodes as $index => $episode) {
$item = []; // Create an empty item
$item['title'] = $this->showTitle . ' ' . $this->showTechDetails . ' - ' . ltrim(trim($episode->plaintext), '-');
$item['uri'] = $links[$index]->href;
$item['content'] = '<a href="' . $item['uri'] . '">' . $item['title'] . '</a>';
$item['uid'] = hash('md5', $item['uri']);
foreach ($episodes as $index => $episode) {
$item = []; // Create an empty item
$item['title'] = $this->showTitle . ' ' . $this->showTechDetails . ' - ' . ltrim(trim($episode->plaintext), '-');
$item['uri'] = $links[$index]->href;
$item['content'] = '<a href="' . $item['uri'] . '">' . $item['title'] . '</a>';
$item['uid'] = hash('md5', $item['uri']);

$this->items[] = $item; // Add this item to the list
}
$this->items[] = $item; // Add this item to the list
}
}

public function getName()
{
switch ($this->queriedContext) {
case 'Suivi de publication de série':
return $this->showTitle . ' ' . $this->showTechDetails . ' - ' . self::NAME;
break;
default:
return self::NAME;
}
public function getName()
{
switch ($this->queriedContext) {
case 'Suivi de publication de série':
return $this->showTitle . ' ' . $this->showTechDetails . ' - ' . self::NAME;
break;
default:
return self::NAME;
}
}

public function getURI()
{
switch ($this->queriedContext) {
case 'Suivi de publication de série':
return self::URI . $this->getInput('url');
break;
default:
return self::URI;
}
public function getURI()
{
switch ($this->queriedContext) {
case 'Suivi de publication de série':
return self::URI . $this->getInput('url');
break;
default:
return self::URI;
}
}

public function detectParameters($url)
{
// Example: https://www.free-telecharger.live/series-vf-hd/145458-the-last-of-us-saison-1-web-dl-720p.html
public function detectParameters($url)
{
// Example: https://www.free-telecharger.live/series-vf-hd/145458-the-last-of-us-saison-1-web-dl-720p.html

$params = [];
$regex = '/^https:\/\/www.*\.free-telecharger\.live\/(series.*\.html)/';
if (preg_match($regex, $url, $matches) > 0) {
$params['url'] = urldecode($matches[1]);
return $params;
}

return null;
$params = [];
$regex = '/^https:\/\/www.*\.free-telecharger\.live\/(series.*\.html)/';
if (preg_match($regex, $url, $matches) > 0) {
$params['context'] = 'Suivi de publication de série';
$params['url'] = urldecode($matches[1]);
return $params;
}

return null;
}
}
1 change: 1 addition & 0 deletions bridges/FunkBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function detectParameters($url)
$regex = '/^https?:\/\/(?:www\.)?funk\.net\/channel\/([^\/]+).*$/';
if (preg_match($regex, $url, $urlMatches) > 0) {
return [
'context' => 'Channel',
'channel' => $urlMatches[1]
];
} else {
Expand Down
4 changes: 4 additions & 0 deletions bridges/FurAffinityBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -603,20 +603,23 @@ public function detectParameters($url)
// Single journal
$regex = '/^(https?:\/\/)?(www\.)?furaffinity.net\/journal\/(\d+)/';
if (preg_match($regex, $url, $matches) > 0) {
$params['context'] = 'Single Journal';
$params['journal-id'] = urldecode($matches[3]);
return $params;
}

// Journals
$regex = '/^(https?:\/\/)?(www\.)?furaffinity.net\/journals\/([^\/&?\n]+)/';
if (preg_match($regex, $url, $matches) > 0) {
$params['context'] = 'Journals';
$params['username-journals'] = urldecode($matches[3]);
return $params;
}

// Gallery folder
$regex = '/^(https?:\/\/)?(www\.)?furaffinity.net\/gallery\/([^\/&?\n]+)\/folder\/(\d+)/';
if (preg_match($regex, $url, $matches) > 0) {
$params['context'] = 'Gallery Folder';
$params['username-folder'] = urldecode($matches[3]);
$params['folder-id'] = urldecode($matches[4]);
$params['full'] = 'on';
Expand All @@ -626,6 +629,7 @@ public function detectParameters($url)
// Gallery (must be after gallery folder)
$regex = '/^(https?:\/\/)?(www\.)?furaffinity.net\/(gallery|scraps|favorites)\/([^\/&?\n]+)/';
if (preg_match($regex, $url, $matches) > 0) {
$params['context'] = 'Gallery';
$params['username-' . $matches[3]] = urldecode($matches[4]);
$params['full'] = 'on';
return $params;
Expand Down
4 changes: 2 additions & 2 deletions bridges/FuturaSciencesBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected function parseItem($newsItem)
$item = parent::parseItem($newsItem);
$item['uri'] = str_replace('#xtor%3DRSS-8', '', $item['uri']);
$article = getSimpleHTMLDOMCached($item['uri']);
//$item['content'] = $this->extractArticleContent($article);
$item['content'] = $this->extractArticleContent($article);
$author = $this->extractAuthor($article);
if (!empty($author)) {
$item['author'] = $author;
Expand All @@ -100,7 +100,7 @@ protected function parseItem($newsItem)

private function extractArticleContent($article)
{
$contents = $article->find('section.article-text', 1);
$contents = $article->find('div.article-text', 0);

foreach ($contents->find('img') as $img) {
if (!empty($img->getAttribute('data-src'))) {
Expand Down
4 changes: 4 additions & 0 deletions bridges/GithubIssueBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,22 +277,26 @@ public function detectParameters($url)
case 2: // Project issues
[$user, $project] = $path_segments;
$show_comments = 'off';
$context = 'Project Issues';
break;
case 3: // Project issues with issue comments
if ($path_segments[2] !== static::URL_PATH) {
return null;
}
[$user, $project] = $path_segments;
$show_comments = 'on';
$context = 'Project Issues';
break;
case 4: // Issue comments
[$user, $project, /* issues */, $issue] = $path_segments;
$context = 'Issue comments';
break;
default:
return null;
}

return [
'context' => $context,
'u' => $user,
'p' => $project,
'c' => $show_comments ?? null,
Expand Down
27 changes: 27 additions & 0 deletions bridges/ImgsedBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,31 @@ public function getName()
}
return parent::getName();
}

public function detectParameters($url)
{
$params = [
'post' => 'on',
'story' => 'on',
'tagged' => 'on'
];
$regex = '/^http(s|):\/\/((www\.|)(instagram.com)\/([a-zA-Z0-9_\.]{1,30})\/(reels\/|tagged\/|)
|(www\.|)(imgsed.com)\/(stories\/|tagged\/|)([a-zA-Z0-9_\.]{1,30})\/)/';
if (preg_match($regex, $url, $matches) > 0) {
$params['context'] = 'Username';
// Extract detected domain using the regex
$domain = $matches[8] ?? $matches[4];
if ($domain == 'imgsed.com') {
$params['u'] = $matches[10];
return $params;
} else if ($domain == 'instagram.com') {
$params['u'] = $matches[5];
return $params;
} else {
return null;
}
} else {
return null;
}
}
}
Loading

0 comments on commit 5cf7df5

Please sign in to comment.