// GET: Forex
        public ActionResult Index()
        {
            ArrayList newsList    = new ArrayList();
            CQ        dom         = CQ.CreateFromUrl("http://www.financemagnates.com/forex");
            CQ        mainArticle = dom.Find("ul.featured_cats_wrapper").Eq(0);

            for (int i = 0; i < mainArticle.Children().Length; i++)
            {
                CQ       article = mainArticle.Children().Eq(i).Find("a").Eq(0);
                newsData nData   = new newsData();
                nData.text    = article.Text();
                nData.alt_url = article.Attr("href").ToString();
                nData.url     = "";
                newsList.Add(nData);
            }
            CQ       addArticle = dom.Find("div.sub-feature").Eq(0);
            newsData firstNews  = new newsData();
            CQ       first      = addArticle.Children("article").Eq(0);

            firstNews.text    = first.Find("a").Eq(0).Find("div").Eq(0).Text();
            firstNews.url     = first.Find("a").Eq(0).Css("background-image");
            firstNews.alt_url = first.Find("a").Eq(0).Attr("href").ToString();
            newsList.Add(firstNews);

            newsData secondNews = new newsData();
            CQ       second     = addArticle.Children("article").Eq(1);

            secondNews.text    = second.Find("a").Eq(0).Find("div").Eq(0).Text();
            secondNews.url     = second.Find("a").Eq(0).Css("background-image");
            secondNews.alt_url = second.Find("a").Eq(0).Attr("href").ToString();
            newsList.Add(secondNews);

            ViewBag.newsList = newsList;
            return(View());
        }
Esempio n. 2
0
        // GET: NewsParse
        public ActionResult Index()
        {
            ArrayList newsList = new ArrayList();

            WebClient    webClient   = new WebClient();
            const string strUrl      = "http://www.edition.cnn.com/world";
            string       pageContent = webClient.DownloadString(strUrl);
            CQ           dom         = pageContent;
            CQ           mainStory   = dom["ul.cn.cn-list-hierarchical-xs.cn--idx-0"].Eq(0);

            for (int i = 0; i < mainStory.Children().Length; i++)
            {
                CQ     news    = mainStory.Children().Eq(i).Children().Eq(0);
                string url     = "";
                string alt_url = "";
                if (news.Find("a").Length != 0)
                {
                    alt_url = news.Find("a").Attr("href").ToString();
                }
                if (news.Find("img").Length != 0)
                {
                    url = news.Find("img").Attr("data-src-large").ToString();
                }

                string   text  = news.Find("span.cd__headline-text").Text();
                newsData nData = new newsData();
                nData.url     = url;
                nData.text    = text;
                nData.alt_url = alt_url;
                newsList.Add(nData);
            }
            CQ lastStory = dom["ul.cn.cn-list-hierarchical-xs.cn--idx-0"].Eq(1);

            for (int i = 0; i < lastStory.Children().Length; i++)
            {
                CQ     news    = lastStory.Children("article").Eq(i).Children().Eq(0);
                string alt_url = "";
                if (news.Find("a").Length != 0)
                {
                    alt_url = news.Find("a").Attr("href").ToString();
                }
                string url = "";
                if (news.Find("img").Length != 0)
                {
                    url = news.Find("img").Attr("data-src-large").ToString();
                }

                string   text  = news.Find("span.cd__headline-text").Text();
                newsData nData = new newsData();
                nData.url     = url;
                nData.alt_url = alt_url;
                nData.text    = text;
                newsList.Add(nData);
            }
            ViewBag.newsList = newsList;
            return(View());
        }
Esempio n. 3
0
        // GET: CryptoCoin
        public ActionResult Index()
        {
            ArrayList newsList    = new ArrayList();
            CQ        dom         = CQ.CreateFromUrl("http://www.cryptocoinsnews.com");
            CQ        mainArticle = dom.Find("div.grid-wrapper").Eq(0);

            for (int i = 0; i < mainArticle.Children(".post").Length; i++)
            {
                CQ       article = mainArticle.Children(".post").Eq(i).Find("a").Eq(0);
                newsData nData   = new newsData();
                nData.text    = article.Attr("title").ToString();
                nData.alt_url = article.Attr("href").ToString();
                nData.url     = "";
                CQ img = article.Children("img").Eq(0);
                nData.url = img.Attr("src").ToString();
                newsList.Add(nData);
            }
            ViewBag.newsList = newsList;
            return(View());
        }
        // GET: CnbcArabia
        public ActionResult Index()
        {
            ArrayList newsList    = new ArrayList();
            CQ        dom         = CQ.CreateFromUrl("http://www.cnbcarabia.com/news/latest");
            CQ        mainArticle = dom.Find("div.blog-news.clearfix");

            for (int i = 0; i < mainArticle.Length; i++)
            {
                CQ       article = mainArticle.Children().Eq(i);
                CQ       data    = article.Find(".blog-box-title").Eq(0).Children("a").Eq(0);
                newsData nData   = new newsData();
                nData.text    = data.Text().ToString();
                nData.alt_url = "http://www.cnbcarabia.com" + data.Attr("href").ToString();
                nData.url     = "";
                CQ img = article.Find("img").Eq(0);
                nData.url = "http://www.cnbcarabia.com" + img.Attr("src");
                newsList.Add(nData);
            }
            ViewBag.newsList = newsList;
            return(View());
        }
Esempio n. 5
0
        // GET: Alarabiya
        public ActionResult Index()
        {
            ArrayList newsList = new ArrayList();
            CQ        dom      = CQ.CreateFromUrl("http://www.alhurra.com/p/349.html");

            newsData topNews = new newsData();
            CQ       tNews   = dom.Find(".img-overlay").Eq(0).Find("a").Eq(0);

            if (tNews.Length != 0)
            {
                topNews.alt_url = tNews.Attr("href").ToString();
                topNews.text    = tNews.Attr("title").ToString();
            }
            CQ cImg = tNews.Find("img").Eq(0);

            if (cImg.Length != 0)
            {
                topNews.url = cImg.Attr("data-src").ToString();
            }
            newsList.Add(topNews);

            CQ mainArticle = dom.Find("#wrowblock-145_12").Eq(0).Find("li");

            for (int i = 0; i < mainArticle.Length; i++)
            {
                CQ       article = mainArticle.Eq(i).Find("a").Eq(0);
                newsData nData   = new newsData();
                nData.text    = article.Attr("title").ToString();
                nData.alt_url = article.Attr("href").ToString();
                nData.url     = "";
                CQ img = article.Find("img").Eq(0);
                if (img.Length != 0)
                {
                    nData.url = img.Attr("data-src").ToString();
                }
                newsList.Add(nData);
            }
            ViewBag.newsList = newsList;
            return(View());
        }
        // GET: Cnbc
        public ActionResult Index()
        {
            ArrayList newsList    = new ArrayList();
            CQ        dom         = CQ.CreateFromUrl("http://www.cnbc.com/world/?region=world");
            CQ        mainArticle = dom.Find("ul.stories_assetlist").Eq(0);

            for (int i = 0; i < mainArticle.Children(".card,.last-card").Length; i++)
            {
                CQ       article = mainArticle.Children(".card").Eq(i);
                CQ       data    = article.Find("div.headline").Eq(0).Children("a").Eq(0);
                newsData nData   = new newsData();
                nData.text    = data.Text().ToString();
                nData.alt_url = data.Attr("href").ToString();
                nData.url     = "";
                CQ img = article.Find("img").Eq(0);
                nData.url = img.Attr("data-img-src");
                newsList.Add(nData);
            }
            CQ smallArticle = dom.Find("ul.stories_assetlist").Eq(1);

            for (int i = 0; i < smallArticle.Children("li").Length; i++)
            {
                CQ article = smallArticle.Children("li").Eq(i);
                CQ data    = article.Find("div.headline").Eq(0).Children("a").Eq(0);
                if (data.Length == 0)
                {
                    continue;
                }
                newsData nData = new newsData();
                nData.text    = data.Text().ToString();
                nData.alt_url = data.Attr("href").ToString();
                nData.url     = "";
                CQ img = article.Find("img").Eq(0);
                nData.url = img.Attr("data-img-src");
                newsList.Add(nData);
            }
            ViewBag.newsList = newsList;
            return(View());
        }
        // GET: Arabbit
        public ActionResult Index()
        {
            ArrayList newsList = new ArrayList();

            CQ dom         = CQ.CreateFromUrl("http://www.arabbit.net");
            CQ mainArticle = dom.Find("div.grid-wrapper").Eq(0);

            for (int i = 0; i < mainArticle.Children().Length; i++)
            {
                newsData nData = new newsData();

                CQ article = mainArticle.Children().Eq(i).Find("a").Eq(0);

                string aText = "";
                string aImg  = "";
                string aAlt  = "";

                if (article.Length != 0)
                {
                    aText = article.Attr("title").ToString();
                    aAlt  = article.Attr("href").ToString();
                }

                nData.text    = aText;
                nData.alt_url = aAlt;
                nData.url     = "";
                CQ img = article.Children("img").Eq(0);
                if (img.Length != 0)
                {
                    aAlt = img.Attr("src").ToString();
                }
                nData.url = aAlt;
                newsList.Add(nData);
            }
            ViewBag.newsList = newsList;
            return(View());
        }