I want to make a plugin for Nova TV (Naslovnica - NOVA TV).
I added the following items in OnlineVideoSites.xml .
I create NovaTVUtil.cs class and added to the OnlineVideos\SiteUtilProjects\OnlineVideos.Sites.hioctane and build project.
Class NovaTVUtil.cs:
When I run plugin, and select a video, function GetWebData (video.VideoUrl) returns me an error "The operation has timed out" and a popup message box: Error getting video playback from urls!
In function getUrl (VideoInfo video) I get a regula video parameter (eg "http://videoteka.novatv.hr/multimedia/vijesti-nove-tv-459.html")
Plugin sometimes works normally and display video, but mostly returns an error
The error occurs in the class OnlineVideos\Plugin\Gui2UtilConnector.cs, in function Internal bool ExecuteInBackgroundAndWait (ThreadStart task, string taskdescription).
Can anyone help me?
THX SaX
I added the following items in OnlineVideoSites.xml .
Code:
<Site name="Videoteka NOVA" util="NovaTV" agecheck="false" enabled="true" lang="hr">
<Configuration>
<item key="dynamicCategoriesRegEx"><![CDATA[]]></item>
<item key="dynamicCategoryUrlDecoding"><![CDATA[False]]></item>
<item key="dynamicSubCategoryUrlDecoding"><![CDATA[False]]></item>
<item key="videoListRegEx"><![CDATA[\<div\sclass="thumb"\>.*?\<div\sclass="img"\>.*?\<img\ssrc="(?<imageUrl>[^"]+).*?\<h2\>\<a\shref="(?<VideoUrl>[^"]+)"\>(?<Title>[^<]+)]]></item>
<item key="videoUrlDecoding"><![CDATA[False]]></item>
<item key="nextPageRegEx"><![CDATA[\<span\sclass='next'\>\<a\shref='(?<NextUrl>[^']+)]]></item>
<item key="nextPageRegExUrlDecoding"><![CDATA[False]]></item>
<item key="prevPageRegEx"><![CDATA[\<span\sclass='previous'\>\<a\shref='(?<PreviousUrl>[^']+)]]></item>
<item key="prevPageRegExUrlDecoding"><![CDATA[False]]></item>
<item key="baseUrl"><![CDATA[http://videoteka.novatv.hr]]></item>
<item key="forceUTF8Encoding"><![CDATA[True]]></item>
</Configuration>
<Categories>
<Category xsi:type="RssLink" name="Informativne emisije ">http://videoteka.novatv.hr/pretraga?group=false&go=Search&keyword=&date=&parent_id=4&channel=&sbmt=Pretraga</Category>
<Category xsi:type="RssLink" name="Serije ">http://videoteka.novatv.hr/pretraga?group=false&go=Search&keyword=&date=&parent_id=6&channel=&sbmt=Pretraga</Category>
<Category xsi:type="RssLink" name="Mini TV ">http://videoteka.novatv.hr/pretraga?group=false&go=Search&keyword=&date=&parent_id=485&channel=&sbmt=Pretraga</Category>
<Category xsi:type="RssLink" name="Sport.dnevnik.hr">http://videoteka.novatv.hr/pretraga?type_id=27274&parent_id=27274&group=true&order=date</Category>
<Category xsi:type="RssLink" name="Dnevnik.hr">http://videoteka.novatv.hr/pretraga?type_id=27263&parent_id=27263&group=true&order=date</Category>
<Category xsi:type="RssLink" name="Zadovoljna.com.hr">http://videoteka.novatv.hr/pretraga?type_id=27270&parent_id=27270&group=true&order=date</Category>
<Category xsi:type="RssLink" name="Showbizz">http://videoteka.novatv.hr/pretraga?type_id=30924&parent_id=30924&group=true&order=date</Category>
<Category xsi:type="RssLink" name="Emisije i magazini ">http://videoteka.novatv.hr/pretraga?group=false&go=Search&keyword=&date=&parent_id=40878&channel=&sbmt=Pretraga</Category>
<Category xsi:type="RssLink" name="Svi videi ">http://videoteka.novatv.hr/pretraga?group=false&go=Search&keyword=&date=&parent_id=&channel=&sbmt=Pretraga</Category>
</Categories>
</Site>
I create NovaTVUtil.cs class and added to the OnlineVideos\SiteUtilProjects\OnlineVideos.Sites.hioctane and build project.
Class NovaTVUtil.cs:
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace OnlineVideos.Sites
{
public class NovaTVUtil : GenericSiteUtil
{
private string URL_regEx = @"//user\strack\svariables.*?var\sut_section_id\s=\s""(?<ut_section_id>[^""]+).*?var\smedia_id\s=\s""(?<media_id>[^""]+).*?var\ssite_id\s=\s""(?<site_id>[^""]+).*?var\ssection_id\s=\s'(?<section_id>[^']+)";
private string URLFile_regEx = @"\<item\stype="".*?src=""(?<FileUrl>[^""]+).*?server=""(?<FileServer>[^""]+)";
private Regex regEx_URL;
private Regex regEx_URLFile;
private string ut_section_id;
private string media_id;
private string site_id;
private string section_id;
private string FileUrl;
private string FileServer;
}
}
public override String getUrl(VideoInfo video)
{
string data = GetWebData(video.VideoUrl);
regEx_URL = new Regex(URL_regEx, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline);
Match m = regEx_URL.Match(data);
if (m.Success)
{
ut_section_id = m.Groups["ut_section_id"].Value;
media_id = m.Groups["media_id"].Value;
site_id = m.Groups["site_id"].Value;
section_id = m.Groups["section_id"].Value;
}
data = GetWebData("http://dnevnik.hr/bin/player/?mod=serve&site_id=" + site_id + "&media_id=" + media_id +
"&userad_id=§ion_id=" + section_id);
regEx_URLFile = new Regex(URLFile_regEx, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline);
m = regEx_URLFile.Match(data);
if (m.Success)
{
FileUrl = m.Groups["FileUrl"].Value;
FileServer = m.Groups["FileServer"].Value;
data = "http://vid" + FileServer + ".dnevnik.hr/" + FileUrl + "-" + FileServer + ".flv";
}
return data;
}
}
}
When I run plugin, and select a video, function GetWebData (video.VideoUrl) returns me an error "The operation has timed out" and a popup message box: Error getting video playback from urls!
In function getUrl (VideoInfo video) I get a regula video parameter (eg "http://videoteka.novatv.hr/multimedia/vijesti-nove-tv-459.html")
Plugin sometimes works normally and display video, but mostly returns an error
The error occurs in the class OnlineVideos\Plugin\Gui2UtilConnector.cs, in function Internal bool ExecuteInBackgroundAndWait (ThreadStart task, string taskdescription).
Can anyone help me?
THX SaX