aboutsummaryrefslogtreecommitdiff
path: root/content_scripts/bridges/twitter.js
blob: 1ffa1312d566aba3a15a7866d6d9e3167bc9db40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function get_twitter() {
    let url = window.location.href;
    let pattern = /twitter.com\/(\w+).*/
    let match = url.match(pattern);
    if (match) {
        let twitter_handle = match[1]

        let feed_url = `${base_url}/?action=display&bridge=Twitter&context=By+username&u=${twitter_handle}&format=`
        let feeds = get_all_types(feed_url)

        let feed_url_norep = `${base_url}/?action=display&bridge=Twitter&context=By+username&u=${twitter_handle}&norep=on&format=`
        let feeds_norep = get_all_types(feed_url, "no replies")

        return feeds.concat(feeds_norep)
    }
    return []
}
register(["twitter"], get_twitter)