Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to use annie as a library? #364

Closed
lherman-cs opened this issue Jan 15, 2019 · 1 comment
Closed

Is there a way to use annie as a library? #364

lherman-cs opened this issue Jan 15, 2019 · 1 comment

Comments

@lherman-cs
Copy link

I want to use annie a video url extractor for my application. But, from what I see is that annie is strongly integrated with "config" that is specified as cli arguments. I could definitely use annie as cli and just use it as a subprocess. But, it seems very hacky and not reliable.

What I want is something like:

package main

import "github.com/iawia002/annie"

func main(){
    url := "https://www.youtube.com/watch?v=jF0kD7lxTTw"
    extractor := annie.New()
    data := extractor.Extract(url)
    // Use the data for my program
}
@iawia002
Copy link
Owner

Theoretically, yes, you can use annie as a library, here is an example:

package main

import (
	"fmt"

	"github.com/iawia002/annie/config"
	"github.com/iawia002/annie/extractors/youtube"
)

func main() {
	url := "https://www.youtube.com/watch?v=jF0kD7lxTTw"
	config.ThreadNumber = 20
	fmt.Println(youtube.Extract(url))
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants