-
Notifications
You must be signed in to change notification settings - Fork 25
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
Replace Graph API and add new features (video and color emojis) #34
base: master
Are you sure you want to change the base?
Conversation
…dd login checker and login CasperJS scripts.
…raper scripts. The new converter is more comprehensive than the old converter that it handles the current types of events like reacted, movies, events, etc.
… is used to generate a regular expression. The license (http://www.unicode.org/copyright.html) allows us to copy and distribute it. These files make it easier to maintain the regular expression.
… and movies. The fallback mode is provided in case the user doesn\'t want to use color emojis.
…recated Graph API edges for notifications and home.
…erJS/PhantomJS script and mplayer. Set external viewers in one place. Set fetch control to limit the crawler based on latest timestamp. Set toggle emojis to enable or disable color emojis or textual interpretation. Pause output locks to prevent disruption of video output. Facebook login temporary login variables used to pass between stages of the login process.
…er scripts. This is required for the news feed and notification core features to work properly.
…hat prefer that aesthetic. Rescale the image to fit vertically in the terminal.
…re new image/movie viewers. The image and movie viewer accept a second argument that control how to view an image/movie. Putting :comment will view the comment sticker photo or movie. :set_show_latest_news controls if you want to see latest or top stories in the news feed. :set_unread_notifications_only controls if you want to see highlighted new or all notifications. :login deletes the old cookies and sets up the login cookies. :view_img_termpic should replace and alias to :view_img. :view_img_caca views an image using libcaca. :view_movie_caca views a YouTube or fbcdn (Facebook content distribution network) movie as an mplayer caca image. :view_spotify_playlist will convert a facebook shared playlist and send it to Spotify. :mailbox has been disabled. :view_img_ev will view an image to an external viewer (defaults to eog [Eye of Gnome] but changable in core.rb). :view_movie_wb views the movie with the HTML5 web browser (defaults to firefox and configurable at core.rb). The require rmagic dependency has been changed to lowercase.
…ilize_emojis 0 to disable showing emojis.
emoji="❓" | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
when "unknown" | ||
emoji="❓" | ||
else | ||
emoji="❓" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surrounding space missing for operator =.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
when "star" | ||
emoji="⭐" | ||
when "unknown" | ||
emoji="❓" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surrounding space missing for operator =.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
emoji="🖼" | ||
when "star" | ||
emoji="⭐" | ||
when "unknown" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
when "photo" | ||
emoji="🖼" | ||
when "star" | ||
emoji="⭐" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surrounding space missing for operator =.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
emoji="📑" | ||
when "photo" | ||
emoji="🖼" | ||
when "star" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
when "bookmarked" | ||
emoji="📑" | ||
when "photo" | ||
emoji="🖼" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surrounding space missing for operator =.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
emoji="🐞" #dunno i never seen the image | ||
when "bookmarked" | ||
emoji="📑" | ||
when "photo" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
when "bug" | ||
emoji="🐞" #dunno i never seen the image | ||
when "bookmarked" | ||
emoji="📑" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surrounding space missing for operator =.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
emoji="🚩" | ||
when "bug" | ||
emoji="🐞" #dunno i never seen the image | ||
when "bookmarked" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
when "page_new_message" | ||
emoji="🚩" | ||
when "bug" | ||
emoji="🐞" #dunno i never seen the image |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surrounding space missing for operator =.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
Missing space after #.
emoji="\e[15;48;5;27m f \e[0m" | ||
when "page_new_message" | ||
emoji="🚩" | ||
when "bug" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
when "facebook" | ||
emoji="\e[15;48;5;27m f \e[0m" | ||
when "page_new_message" | ||
emoji="🚩" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surrounding space missing for operator =.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
emoji="💬" | ||
when "facebook" | ||
emoji="\e[15;48;5;27m f \e[0m" | ||
when "page_new_message" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
when "commented" | ||
emoji="💬" | ||
when "facebook" | ||
emoji="\e[15;48;5;27m f \e[0m" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surrounding space missing for operator =.
emoji="📅" | ||
when "commented" | ||
emoji="💬" | ||
when "facebook" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
@@ -13,7 +13,10 @@ def parse(argv) | |||
opt.on('--enable_img_view VALUE') do |v| | |||
config[:enable_img_view] = v | |||
end | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
# end | ||
#end | ||
#help :mailbox, "read mailbox", ":mailbox [mail number]" | ||
#aliasing :mailbox, :m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after #.
# } | ||
# end | ||
#end | ||
#help :mailbox, "read mailbox", ":mailbox [mail number]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after #.
# instant_output(Item.new(info: :mails)) | ||
# } | ||
# end | ||
#end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after #.
# raise Exception.new("need two parameters") if targets.size != 2 | ||
# threadnum, messagenum = targets | ||
# mail = mailbox_cache[threadnum] | ||
# instant_output(Item.new(info: :mail, content: {mail: mail, messagenum: messagenum})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [93/80]
end | ||
help :mailbox, "read mailbox", ":mailbox [mail number]" | ||
aliasing :mailbox, :m | ||
#command :mailbox do |target| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after #.
Process.detach(pid) | ||
end | ||
end | ||
help :view_spotify_playlist, "view a spotify playlist", ":view_spotify_playlist [code]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
Line is too long. [91/80]
if link.include? "https://open.spotify.com/user/" and link.include? "/playlist/" | ||
url = link.gsub(%r{https://open.spotify.com/user/([a-zA-Z0-9]+)/playlist/([a-zA-Z0-9]+)#},"spotify:user:\\1:playlist:\\2"); | ||
cmd=%Q[spotify --uri="#{url}"] | ||
pid=spawn("#{cmd}", [:err, :out]=>"/dev/null",:pgroup=>true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surrounding space missing for operator =.
Prefer to_s over string interpolation.
Surrounding space missing for operator =>.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
Space missing after comma.
|
||
if link.include? "https://open.spotify.com/user/" and link.include? "/playlist/" | ||
url = link.gsub(%r{https://open.spotify.com/user/([a-zA-Z0-9]+)/playlist/([a-zA-Z0-9]+)#},"spotify:user:\\1:playlist:\\2"); | ||
cmd=%Q[spotify --uri="#{url}"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surrounding space missing for operator =.
Use % instead of %Q.
%Q-literals should be delimited by ( and ).
link = item.data.link | ||
|
||
if link.include? "https://open.spotify.com/user/" and link.include? "/playlist/" | ||
url = link.gsub(%r{https://open.spotify.com/user/([a-zA-Z0-9]+)/playlist/([a-zA-Z0-9]+)#},"spotify:user:\\1:playlist:\\2"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [131/80]
Space missing after comma.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
Do not use semicolons to terminate expressions.
item = post_code_reverse_map[post_code] | ||
link = item.data.link | ||
|
||
if link.include? "https://open.spotify.com/user/" and link.include? "/playlist/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
Use && instead of and.
Line is too long. [86/80]
post_code = "$#{post_code}" | ||
item = post_code_reverse_map[post_code] | ||
link = item.data.link | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
@@ -176,6 +344,21 @@ def match_single_command(text) | |||
end | |||
help :view_likes, "view likes detail from a post", ":view_likes [code]" | |||
aliasing :view_likes, :vl | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
pid = spawn("#{config[:external_www_browser]} \"#{video}\"") | ||
Process.detach(pid) | ||
end | ||
help :view_movie_wb, "view movie in web browser", ":view_movie_wb [code]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
else | ||
video = item.data.video | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
if target == :comment | ||
video = item.data.comment_youtube | ||
else | ||
video = item.data.video |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tab detected.
Use 2 (not -4) spaces for indentation.
item = post_code_reverse_map[post_code] | ||
|
||
if target == :comment | ||
video = item.data.comment_youtube |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tab detected.
Use 2 (not -4) spaces for indentation.
…hy.com or youtu.be.
…better corresponding colors.
…es the :clear_cache command.
Do not merge until I put Facebook live video support. I plan to switch out the mplayer with vlc. |
This one will replace the deprecated /me/home /me/notifications with a web-scraped backend using the headless CasperJS/PhantomJS.
Other features added:
View Facebook videos and YouTube using mplayer+libcaca.
View images with either Termpic or libcaca backend.
Better color emoji support. Replace parts with some emojis and display reaction emojis.
Support for Facebook reactions (Haha, Love, Sad, Angry, Wow)
More support for different types of posts (commerical ads, events, movies, travel.)
Support for loading shared Spotify playlists into Spotify.
Support for Animated GIF posts with Giphy
New commands:
:view_spotify_playlist, :vsp - load shared playlist into spotify
:login - delete CasperJS cookies and log in back into Facebook.
:set_notification_pages :np - sets number of pages fetch initially - may be removed because improved scraping controls.
:set_news_feed_pages, :nfp - sets number of pages fetch initially - may be removed because improved scraping controls.
:set_new_notifications_only, :nn - show marked notifications only. set 1 to show highlighted or set 0 to show all.
:set_show_latest_news, :sln - show latest news. set 1 to show latest stories or 0 to show top stories.
:view_img_caca, :vic - view image using caca. second argument is optional which can be :post or :comment.
:view_img_termpic, :vit, :view_img, :vi - view image using termpic. second argument is optional which can be :post or :comment.
:view_img_ev, :viev - view image using external viewer. second argument is optional which can be :post or :comment. The default is eog (Eye of Gnome) and can be changed in core.rb.
:view_movie_caca, :vmc - view movie using mplayer and libcaca. second argument is optional which can be :post or :comment.
:view_movie_wb, :vmwb - view movie in web browser. second argument is optional which can be :post or :comment. The default is Firefox and can be changed in core.rb.
Removed command :mailbox
Currently Broken:
The following are broken because Facebook's BigPipe or PhantomJS's fork of qtwebkit could be breaking it and needs to be modded. It could also be caused by overlooked timing issue cause by our CasperJS scripts. The AJAX/BigPipe is not dumping the DOM element.
-Support for fetching comments.
-Facebook Live. It is possible to fetch the mpeg dash url via youtube-dl and vlc
Added Dependencies they need to be downloaded or scripts need to check for required dependencies: