diff --git a/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/Twitter_techsupportgore_bot.java b/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/Twitter_techsupportgore_bot.java index a73f181..ce6a3ea 100644 --- a/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/Twitter_techsupportgore_bot.java +++ b/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/Twitter_techsupportgore_bot.java @@ -26,6 +26,8 @@ import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; +import twitter_techsupportgore_bot.reddit_handler.RedditPost; +import twitter_techsupportgore_bot.reddit_handler.RedditPostLink; /** * This is where everything begins. @@ -40,12 +42,15 @@ public class Twitter_techsupportgore_bot { * Launch the bot. * * @param args the command line arguments + * @throws java.net.MalformedURLException + * @throws java.net.ProtocolException */ public static void main(String[] args) throws MalformedURLException, ProtocolException, IOException { String url = "https://www.reddit.com/r/techsupportgore/new.json?limit=75"; + /* try { URL myurl = new URL(url); @@ -95,5 +100,7 @@ public class Twitter_techsupportgore_bot { con.disconnect(); } + + */ } } diff --git a/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/reddit_handler/RedditPost.java b/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/reddit_handler/RedditPost.java new file mode 100644 index 0000000..56b560e --- /dev/null +++ b/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/reddit_handler/RedditPost.java @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2019 louis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package twitter_techsupportgore_bot.reddit_handler; + +/** + * This is an abstract class to define all RedditPosts. + * + * @author louis + */ +public abstract class RedditPost { + + /** + * Post's title. + */ + protected String title; + + /** + * Is the post in quarantine? + */ + protected boolean quarantine; + + /** + * Post's score. + */ + protected double score; + + /** + * Post's hint. + */ + protected String postHint; + + /** + * Is this post crosspostable? + */ + protected boolean crosspostable; + + /** + * Is this post NSFW? + */ + protected boolean over18; + + /** + * Post's author. + */ + protected String author; + + /** + * Post's permalink. + */ + protected String permalink; + + /** + * Is this post a spoiler? + */ + protected boolean spoiler; + + public RedditPost(String title, boolean quarantine, double score, String postHint, boolean crosspostable, boolean over18, String author, String permalink, boolean spoiler) { + this.title = title; + this.quarantine = quarantine; + this.score = score; + this.postHint = postHint; + this.crosspostable = crosspostable; + this.over18 = over18; + this.author = author; + this.permalink = permalink; + this.spoiler = spoiler; + } + + public String getTitle() { + return title; + } + + public boolean isQuarantine() { + return quarantine; + } + + public double getScore() { + return score; + } + + public String getPostHint() { + return postHint; + } + + public boolean isCrosspostable() { + return crosspostable; + } + + public boolean isOver18() { + return over18; + } + + public String getAuthor() { + return author; + } + + public String getPermalink() { + return permalink; + } + + public boolean isSpoiler() { + return spoiler; + } + + + +} diff --git a/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/reddit_handler/RedditPostImage.java b/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/reddit_handler/RedditPostImage.java new file mode 100644 index 0000000..a2f238f --- /dev/null +++ b/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/reddit_handler/RedditPostImage.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2019 louis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package twitter_techsupportgore_bot.reddit_handler; + +/** + * + * @author louis + */ +public class RedditPostImage extends RedditPost { + +} diff --git a/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/reddit_handler/RedditPostLink.java b/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/reddit_handler/RedditPostLink.java new file mode 100644 index 0000000..78bd870 --- /dev/null +++ b/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/reddit_handler/RedditPostLink.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2019 louis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package twitter_techsupportgore_bot.reddit_handler; + +/** + * + * @author louis + */ +public class RedditPostLink extends RedditPost { + +} diff --git a/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/reddit_handler/RedditPostText.java b/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/reddit_handler/RedditPostText.java new file mode 100644 index 0000000..699eb88 --- /dev/null +++ b/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/reddit_handler/RedditPostText.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2019 louis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package twitter_techsupportgore_bot.reddit_handler; + +/** + * + * @author louis + */ +public class RedditPostText extends RedditPost { + +} diff --git a/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/reddit_handler/RedditPostVideo.java b/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/reddit_handler/RedditPostVideo.java new file mode 100644 index 0000000..f9cf19b --- /dev/null +++ b/twitter_techsupportgore_bot/src/twitter_techsupportgore_bot/reddit_handler/RedditPostVideo.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2019 louis + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package twitter_techsupportgore_bot.reddit_handler; + +/** + * + * @author louis + */ +public class RedditPostVideo extends RedditPost{ + +}