codethug / SimpleTv

SimpleTV SDK and show downloader
MIT License
1 stars 0 forks source link

Parsing bug #32

Closed OceanDisciple closed 8 years ago

OceanDisciple commented 8 years ago

I get the following error when trying to download a specific show. It is cause by the first A tag being different that what you are expecting.

Adding a SkipWhile fixed the issue. Id = article.SelectTag("a").SkipWhile(e => e.Attributes["data-itemid"] == null).FirstOrDefault() .IfNotNull(e => new Guid(e.Attributes["data-itemid"].Value))

SimpleTv.DownloadLog.2016-04-18_21-23-37.json.txt

Unhandled Exception: NullReferenceException: Object reference not set to an instance of an object. Stack Trace: at SimpleTv.Sdk.Http.HtmlParserExtensions.<>c.b4_1(HtmlNode e) in C:\projects\simpletv\SimpleTv.Sdk\Http\HtmlParserExtensions.cs:line 142 at SimpleTv.Sdk.Http.HtmlParserExtensions.IfNotNull[S,T](S source, Func`2 evaluateIfSourceNotNull) in C:\projects\simpletv\SimpleTv.Sdk\Http\HtmlParserExtensions.cs:line 214 at SimpleTv.Sdk.Http.HtmlParserExtensions.<>c__DisplayClass4_0.b0(HtmlNode article) in C:\projects\simpletv\SimpleTv.Sdk\Http\HtmlParserExtensions.cs:line 137 at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at SimpleTv.Sdk.Http.HtmlParserExtensions.ParseEpisodes(HtmlDocument html, Show show) in C:\projects\simpletv\SimpleTv.Sdk\Http\HtmlParserExtensions.cs:line 135 at SimpleTv.Sdk.Http.SimpleTvHttpClient.GetEpisodes(Show show) in C:\projects\simpletv\SimpleTv.Sdk\Http\SimpleTvHttpClient.cs:line 212 at SimpleTv.Downloader.Downloader.Download()

at SimpleTv.Downloader.Program.Main(String[] args)

            <div class="f_right buttons">
                        <a class="buttonswitch edit-meta" data-instanceid="54e4e8e6-e6f1-11e3-ae60-22000b278f17" data-groupid="2fea6b2a-d10d-11e3-9541-22000aa62ab4">Edit</a>
                    <a data-groupid="2fea6b2a-d10d-11e3-9541-22000aa62ab4" data-itemid="8531ba48-b88f-11e3-9541-22000aa62ab4" data-instanceid="54e4e8e6-e6f1-11e3-ae60-22000b278f17" class="button-standard-watch">Watch <span></span></a>
                    <a class="buttonswitch self delete">
                        <span></span>Delete 
                    </a>

            </div>