Skip to content

Commit

Permalink
optimize search engine to allow it display more results
Browse files Browse the repository at this point in the history
  • Loading branch information
evanhyd committed Sep 7, 2024
1 parent 68141e7 commit 588bbc3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion source/FyneApp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Website = "https://github.com/evanhyd"
Name = "meowyplayer"
ID = "com.meowyplayer"
Version = "2.4.1"
Build = 55
Build = 56
4 changes: 2 additions & 2 deletions source/browser/clipzag.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ type clipzagScraper struct {
func newClipzagScraper() *clipzagScraper {
const pattern = `<a class="title-color" href="watch\?v=(.+)">\n` + //videoID
`<div class="video-thumbs">\n` +
`<img class="videosthumbs-style" data-thumb-m=".+" data-thumb="//(.+)" src="//.+"><span class="duration">(.+)</span></div>\n` + //thumbnail, length
`<img class="videosthumbs-style" data-thumb-m(?:=".+")? data-thumb="//(.+)" src="//.+"><span class="duration">(.+)</span></div>\n` + //thumbnail, length
`<div class="title-style" title="(.+)">.+</div>\n` + //title
`</a>\n` +
`<div class="viewsanduser">\n` +
`<span style="font-weight:bold;"><a class="by-user" href="/channel\?id=(.+)">(.+)</a><br/>(.+)</span>\n` + //channel id, channel title, stats
`</div>\n` +
`<div class="postdiscription">(.+)</div>` //description

return &clipzagScraper{regexp.MustCompilePOSIX(pattern)}
return &clipzagScraper{regexp.MustCompile(pattern)}
}

func (s *clipzagScraper) Search(title string) ([]Result, error) {
Expand Down
3 changes: 1 addition & 2 deletions source/view/home_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ func (p *HomePage) searchTitle(title string) {
results, err := p.searcher.Search(title)
if err != nil {
fyne.LogError("browser searchTitle failed", err)
}
if len(results) > 0 {
} else if len(results) > 0 {
p.searchBar.Update(results)
return
}
Expand Down

0 comments on commit 588bbc3

Please sign in to comment.