oFile::Scrape(ScraperPtr& scraper, const CStdString& strURL /* = "" */) { if (scraper->Type() != m_type) { return 1; } if (!scraper->Load()) return 0; // init and clear cache scraper->ClearCache(); vector<CStdString> extras; CScraperUrl url; CFileCurl http; if (strURL.IsEmpty()) { if (!DoScrape(scraper)) return 2; if (m_strImDbUrl.size() > 0) return 0; else return 1; } else // we check to identify the episodeguide url { extras.push_back(strURL); vector<CStdString> result = scraper->Run("EpisodeGuideUrl",url,http,&extras); if (result.empty() || result[0].IsEmpty()) return 1; return 0; } }
int CNfoFile::Scrape(ScraperPtr& scraper, const CStdString& strURL /* = "" */) { if (scraper->Type() != m_type) { return 1; } if (!scraper->Load()) return 0; // init and clear cache scraper->ClearCache(); vector<CStdString> extras; CScraperUrl url; CFileCurl http; if (strURL.IsEmpty()) { extras.push_back(m_doc); vector<CStdString> result; if (scraper->GetParser().HasFunction("NfoScrape")) result = scraper->Run("NfoScrape",url,http,&extras); if (!result.empty()) { TiXmlDocument doc; doc.Parse(m_strImDbUrl.c_str()); if (doc.RootElement() && doc.RootElement()->FirstChildElement()) { CVideoInfoTag details; if (GetDetails(details,m_strImDbUrl.c_str())) { Close(); m_size = m_strImDbUrl.size(); m_doc = new char[m_size+1]; m_headofdoc = m_doc; strcpy(m_doc,m_strImDbUrl.c_str()); return 0; } } } if (!DoScrape(scraper)) return 2; if (m_strImDbUrl.size() > 0) return 0; else return 1; } else // we check to identify the episodeguide url { extras.push_back(strURL); vector<CStdString> result = scraper->Run("EpisodeGuideUrl",url,http,&extras); if (result.empty() || result[0].IsEmpty()) return 1; return 0; } }