Skip to content

Is there a more detailed guide to creating a new bridge? #3345

Answered by dvikan
arozbiz asked this question in Q&A
Discussion options

You must be logged in to vote

You have to manually scrape and parse out items. Not much automatic here. Example:

<?php

class BearBlogBridge extends BridgeAbstract
{
    const NAME = 'BearBlog (bearblog.dev)';

    public function collectData()
    {
        $dom = getSimpleHTMLDOM('https://herman.bearblog.dev/blog/');
        foreach ($dom->find('.blog-posts li') as $li) {
            $a = $li->find('a', 0);
            $this->items[] = [
                'title' => $a->plaintext,
                'uri' => 'https://herman.bearblog.dev' . $a->href,
            ];
        }
    }
}

You also need to learn css-style traversing of the DOM. Example: $dom->find('div.items > item > p')

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@arozbiz
Comment options

@dvikan
Comment options

@arozbiz
Comment options

@ispdbcom
Comment options

Answer selected by arozbiz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants