G_cat commited on
Commit
e77eef6
·
unverified ·
1 Parent(s): 991c571

Added == comparison between YouTube objects. (#1161)

Browse files
Files changed (1) hide show
  1. pytube/__main__.py +4 -0
pytube/__main__.py CHANGED
@@ -91,6 +91,10 @@ class YouTube:
91
  def __repr__(self):
92
  return f'<pytube.__main__.YouTube object: videoId={self.video_id}>'
93
 
 
 
 
 
94
  @property
95
  def watch_html(self):
96
  if self._watch_html:
 
91
  def __repr__(self):
92
  return f'<pytube.__main__.YouTube object: videoId={self.video_id}>'
93
 
94
+ def __eq__(self, o: object) -> bool:
95
+ # Compare types and urls, if they're same return true, else return false.
96
+ return type(o) == type(self) and o.watch_url == self.watch_url
97
+
98
  @property
99
  def watch_html(self):
100
  if self._watch_html: