#!/usr/bin/env python
# vim:fileencoding=utf-8
from calibre.web.feeds.news import BasicNewsRecipe


class ComputerWeekly(BasicNewsRecipe):
    title = 'ComputerWeekly'
    __author__ = 'İlker Melik Sıtkı'
    oldest_article = 7
    max_articles_per_feed = 100
    language = 'en'
    remove_javascript = True
    no_stylesheets = True

    feeds = [
        ('IT careers and IT skills', 'https://www.computerweekly.com/rss/IT-careers-and-IT-skills.xml'),
        ('IT hardware', 'https://www.computerweekly.com/rss/IT-hardware.xml'),
        ('IT management', 'https://www.computerweekly.com/rss/IT-management.xml'),
        ('IT security', 'https://www.computerweekly.com/rss/IT-security.xml'),
        ('Networking and communication', 'https://www.computerweekly.com/rss/Networking-and-communication.xml'),
        ('Storage', 'https://www.computerweekly.com/rss/Storage.xml'),
        ('Mobile technology', 'https://www.computerweekly.com/rss/Mobile-technology.xml'),
        ('Internet technology', 'https://www.computerweekly.com/rss/Internet-technology.xml'),
        ('IT services and outsourcing', 'https://www.computerweekly.com/rss/IT-services-and-outsourcing.xml'),
        ('Financial services IT news', 'https://www.computerweekly.com/rss/Financial-services-IT-news.xml'),
        ('Public sector IT news', 'https://www.computerweekly.com/rss/Public-sector-IT-news.xml'),
        ('Enterprise software', 'https://www.computerweekly.com/rss/Enterprise-software.xml'),
        ('SME IT news', 'https://www.computerweekly.com/rss/SME-IT-news.xml'),
        ('Datacenter and cloud computing', 'https://www.computerweekly.com/rss/Datacentre-and-cloud-computing.xml'),
        ('Storage', 'https://www.computerweekly.com/rss/Storage.xml'),
        ('Information Management', 'https://www.computerweekly.com/rss/Information-management.xml'),
        ('Nordics', 'https://www.computerweekly.com/rss/Nordics.xml'),
        ('ANZ', 'https://www.computerweekly.com/rss/ANZ.xml'),
        ('ASEAN', 'https://www.computerweekly.com/rss/ASEAN.xml'),
        ('Asia Pacific', 'https://www.computerweekly.com/rss/Asia-Pacific.xml'),
        ('Google Editor Picks', 'https://www.computerweekly.com/editorspicks'),
    ]

    keep_only_tags = [
        dict(name='h1', attrs={'class': 'main-article-title'}),
        dict(name='h2', attrs={'class': 'main-article-subtitle'}),
        dict(name='div', attrs={'class': 'main-article-author'}),
        dict(name='section', attrs={'id': 'content-body'}),
    ]
