Full Code of aandrew-me/ytDownloader for AI

main e47396622f40 cached
56 files
431.6 KB
127.9k tokens
131 symbols
1 requests
Download .txt
Showing preview only (450K chars total). Download the full file or copy to clipboard to get everything.
Repository: aandrew-me/ytDownloader
Branch: main
Commit: e47396622f40
Files: 56
Total size: 431.6 KB

Directory structure:
gitextract_gpcjyyrr/

├── .gitignore
├── LICENSE
├── README.md
├── assets/
│   └── css/
│       ├── extra.css
│       └── index.css
├── crowdin.yml
├── flatpak/
│   ├── io.github.aandrew_me.ytdn.desktop
│   └── io.github.aandrew_me.ytdn.metainfo.xml
├── html/
│   ├── about.html
│   ├── compressor.html
│   ├── history.html
│   ├── index.html
│   ├── playlist.html
│   ├── playlist_new.html
│   └── preferences.html
├── linux.sh
├── mac.sh
├── main.js
├── package.json
├── resources/
│   └── icon.icns
├── src/
│   ├── common.js
│   ├── compressor.js
│   ├── history.js
│   ├── index.js
│   ├── playlist.js
│   ├── playlist_new.js
│   ├── preferences.js
│   ├── renderer.js
│   └── types.d.ts
├── translations/
│   ├── ar-SA.json
│   ├── bn-BD.json
│   ├── de-DE.json
│   ├── el-GR.json
│   ├── en.json
│   ├── es-ES.json
│   ├── fa-IR.json
│   ├── fi-FI.json
│   ├── fr-FR.json
│   ├── hi-IN.json
│   ├── hu-HU.json
│   ├── i18n-init.js
│   ├── i18n.js
│   ├── it-IT.json
│   ├── ja-JP.json
│   ├── ne-NP.json
│   ├── pl-PL.json
│   ├── pt-BR.json
│   ├── ru-RU.json
│   ├── tr-TR.json
│   ├── uk-UA.json
│   ├── vi-VN.json
│   ├── zh-CN.json
│   └── zh-TW.json
├── tsconfig.json
├── windows.ps1
└── ytdownloader.json

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
node_modules
release
test.js
.*
!/.gitignore
todo.txt
ffmpeg*
ffmpeg.exe
generated-sources.json
ffmpeg.patch
deno*
node.exe
node

================================================
FILE: LICENSE
================================================
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    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 <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    <program>  Copyright (C) <year>  <name of author>
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.

  The GNU General Public License does not permit incorporating your program
into proprietary programs.  If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.  But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.


================================================
FILE: README.md
================================================
<img src="https://github-production-user-asset-6210df.s3.amazonaws.com/66430340/238887646-33b4cba9-3c45-4042-83d1-b79e94a3a769.png" style="width:80px;">

# ytDownloader

[![Flathub](https://img.shields.io/flathub/downloads/io.github.aandrew_me.ytdn?label=Flathub%20downloads)](https://flathub.org/apps/details/me.aandrew.ytdownloader)
[![GitHub downloads](https://img.shields.io/github/downloads/aandrew-me/ytdownloader/total?label=Github%20downloads)](https://github.com/aandrew-me/ytDownloader/releases)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/aandrew-me/ytdownloader?label=latest%20release)](https://github.com/aandrew-me/ytDownloader/releases/latest)
[![Flathub](https://img.shields.io/flathub/v/io.github.aandrew_me.ytdn)](https://flathub.org/apps/io.github.aandrew_me.ytdn)
[![Snapcraft](https://img.shields.io/snapcraft/v/ytdownloader/latest/stable)](https://snapcraft.io/ytdownloader)
![Chocolatey Version](https://img.shields.io/chocolatey/v/ytdownloader)
![WinGet Package Version](https://img.shields.io/winget/v/aandrew-me.ytDownloader)

A modern GUI video and audio downloader supporting [hundreds of sites](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)


[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/ytdownloader)
[![Get AppImage](https://raw.githubusercontent.com/srevinsaju/get-appimage/master/static/badges/get-appimage-branding-blue.png)](https://github.com/aandrew-me/ytDownloader/releases/latest/download/YTDownloader_Linux.AppImage)
<a href="https://flathub.org/apps/io.github.aandrew_me.ytdn"><img src="https://flathub.org/api/badge?svg&locale=en" style="width:180px;"></a>
<a href="https://github.com/aandrew-me/ytDownloader/releases/latest/download/YTDownloader_Win.exe
"><img src="https://user-images.githubusercontent.com/66430340/187172806-a8edd12a-ef58-4a05-96a3-99d7490b42f6.png" style="width:190px;"></a>
<a href="https://github.com/aandrew-me/ytDownloader/releases/latest/download/YTDownloader_Mac_arm64.dmg"><img src="https://cdn.jsdelivr.net/gh/aandrew-me/badges/download_mac_apple_silicon.png" style="width:200px;"></a>
<a href="https://github.com/aandrew-me/ytDownloader/releases/latest/download/YTDownloader_Mac_x64.dmg"><img src="https://cdn.jsdelivr.net/gh/aandrew-me/badges/download_mac_intel.png" style="width:200px;"></a>
<a href="https://community.chocolatey.org/packages/ytdownloader"><img style="width:200px;" src="https://github-production-user-asset-6210df.s3.amazonaws.com/66430340/238886537-7b2769fe-bd62-4921-a0eb-edf2eb06216d.png" alt="Chocolatey"></a>

## Features 🚀


✅ Supports hundreds of sites including Youtube, Facebook, Instagram, Tiktok, Twitter and so on.

✅ Multiple themes

✅ Video Compressor with Hardware Acceleration

✅ Advanced options like Range Selection, Subtitles

✅ Download playlists

✅ Available on Linux, Windows & macOS

✅ Fast download speeds

✅ And of-course no trackers or ads

## Screenshots

<!-- ![dark](https://user-images.githubusercontent.com/66430340/196022794-885e5b90-40d2-4b58-a8fa-74f10c6e470e.png) -->
<!-- ![light](https://user-images.githubusercontent.com/66430340/196022796-1215038d-bafb-4450-82b1-7baddd60c0e8.png) -->


<!-- ![ytdownloader_dark](https://github.com/aandrew-me/ytDownloader/assets/66430340/62efbca0-28b8-4016-bcf2-1a14bcaa782c) -->
<!-- ![ytdownloader_light](https://github.com/aandrew-me/ytDownloader/assets/66430340/34f5270f-bdea-460e-8622-6459cd147b73) -->

![ss_homepage](https://github.com/user-attachments/assets/12410bca-31c3-48a0-bbd3-1d74bcc752b6)
![ss_settings](https://github.com/user-attachments/assets/060557bc-d209-4bd0-bda4-debe42ca83a0)
![ss_compressor](https://github.com/user-attachments/assets/52da7e50-46bb-4749-8152-5e79324a6cc3)



<!-- ![ytdownloader_dark](https://github.com/aandrew-me/ytDownloader/assets/66430340/2f6695e7-6ca0-4f7c-91a0-0ad735c1e3af) -->
<!-- ![ytdownloader_light](https://github.com/aandrew-me/ytDownloader/assets/66430340/3c974ab0-8257-4b8a-88ec-ee6bd119751e) -->

# Installation

## Windows 🪟

-   **Traditional way**

    Download and install the exe or msi file. Exe file lets you choose custom download location, msi file doesn't ask for location. Windows defender may show a popup saying **Windows Protected Your PC**. Just click on **More info** and click on **Run Anyway**

-   **Chocolatey**
    App can be installed from [Chocolatey](https://community.chocolatey.org/packages/ytdownloader) using the following command
    ```
    choco install ytdownloader
    ```
-   **Scoop**
    App can be installed with [Scoop](https://scoop.sh) using the following command
    ```
    scoop install https://raw.githubusercontent.com/aandrew-me/ytDownloader/main/ytdownloader.json
    ```
-   **Winget**

    App can be installed with [Winget](https://github.com/microsoft/winget-cli) using the following command
    ```
    winget install aandrew-me.ytDownloader
    ```
## Linux 🐧

Linux has several options available - Flatpak, AppImage and Snap.
Flatpak is recommended. For arm processors, download from flathub.

-   ### AppImage

    **AppImage** format is supported on most Linux distros and has Auto-Update support.
    It just needs to be executed after downloading. See more about [AppImages here](https://appimage.org/).

    [AppImageLauncher](https://github.com/TheAssassin/AppImageLauncher) is recommended for integrating AppImages.

-   ### Flatpak
    ```
    flatpak install flathub io.github.aandrew_me.ytdn
    ```
-   ### Snapcraft
    ```
    sudo snap install ytdownloader
    ```

## macOS 🍎

Since the app is not signed, when you will try to open the app, macOS will not allow you to open it. 

You need to open terminal and execute:
```
sudo xattr -r -d com.apple.quarantine /Applications/YTDownloader.app 
```

You will also need to install `yt-dlp` with [homebrew](https://brew.sh/)
```
brew install yt-dlp
```

## Internationalization (Localization) 🌍

Translations into other languages would be highly appreciated. If you want to help translating the app to other languages, you can join from [here](https://crwd.in/ytdownloader). Open a new issue and that language will be added to Crowdin. Please don't make pull requests with json files, instead use Crowdin.

[![Crowdin](https://badges.crowdin.net/ytdownloader/localized.svg)](https://crowdin.com/project/ytdownloader)

### ✅ Available languages

| Name                | Status |
| ------------------- | ------ |
| Arabic              | ✔️     |
| Bengali             | ✔️     |
| English             | ✔️     |
| Chinese Simplified  | ✔️     |
| Chinese Traditional | ✔️     |
| Finnish             | ✔️     |
| Hindi               | ✔️     |
| French              | ✔️     |
| Finnish             | ✔️     |
| German              | ✔️     |
| Greek               | ✔️     |
| Hungarian           | ✔️     |
| Italian             | ✔️     |
| Japanese            | ✔️     |
| Persian             | ✔️     |
| Polish              | ✔️     |
| Portuguese (Brazil) | ✔️     |
| Russian             | ✔️     |
| Spanish             | ✔️     |
| Turkish             | ✔️     |
| Ukrainian           | ✔️     |
| Vietnamese          | ✔️     |

Thanks to [nxjosephofficial](https://github.com/nxjosephofficial), [LINUX-SAUNA](https://t.me/linuxsauna), [Proxycon](https://github.com/proxycon), [albanobattistella](https://github.com/albanobattistella), [TheBlueQuasar](https://github.com/TheBlueQuasar), [MrQuerter](https://github.com/MrQuerter), [KotoWhiskas](https://github.com/KotoWhiskas), [André](https://github.com/andre1828), [haggen88](https://github.com/haggen88), [XfedeX](https://github.com/XfedeX), [Jok3r](https://github.com/th3knv), [TitouanReal](https://github.com/TitouanReal), [soredake](https://github.com/soredake), [yoi](https://github.com/thiennguyenqn), [HowlingWerewolf](https://github.com/HowlingWerewolf), [Kum](https://github.com/kum4423), [Mohammed Bakry](https://crowdin.com/profile/m7md_b4kry), [Huang Bingfeng](https://github.com/jackiotyu), [Abhinav](https://github.com/abhixdd), [CodWiz](https://github.com/C0dwiz) and others for helping.

## Used technologies

-   [yt-dlp](https://github.com/yt-dlp/yt-dlp)
-   [Electron](https://www.electronjs.org/)
-   [ffmpeg](https://ffmpeg.org/)
-   [nodeJS](https://nodejs.org/en/)
-   [flaticon](https://www.flaticon.com/)

## For building or running from source code

[Nodejs](https://nodejs.org/) (along with npm) needs to be installed.

Required commands to get started.

```
git clone https://github.com/aandrew-me/ytDownloader.git
cd ytDownloader
npm i
```

To run with [Electron](https://www.electronjs.org/) :

```
npm start
```

You need to download ffmpeg and put it in the root directory of the project. If you don't need to build for arm processor, you can download ffmpeg by executing any of the files - linux.sh / mac.sh / windows.sh depending on the platform. Otherwise you need to download ffmpeg from [here](https://github.com/yt-dlp/FFmpeg-Builds/releases) for windows/linux and from [here](http://www.osxexperts.net/) for mac (not tested)

To build for Linux (It will create packages as specified in package.json). The builds are stored in **release** folder.
```
npm run linux
```

To build for Windows

```
npm run windows
```

To build for macOS

```
npm run mac
```
If you only want to build for one format, you can do
```
npx electron-builder -l appimage
```
It will just create a linux appimage build.


================================================
FILE: assets/css/extra.css
================================================
@font-face {
	font-family: "JetBrains";
	src: url("../fonts/JetBrainsMono-Regular.ttf") format("truetype");
}

:root[theme="light"] {
	--background: #f9fafb;
	--text: #1f2937;
	--box-main: #f3f4f6;
	--box-toggle: rgb(215 238 233);
	--box-separation: #e5e7eb;
	--box-toggleOn: rgb(127, 250, 172);
	--item-bg: #dddddd;
	--box-shadow: none;
	--select: #a7f3d0;
	--greenBtn: #22c55e;
	--greenBtn-bottom: #16a34a;
	--redBtn: #d64d4f;
	--redBtn-bottom: #854243;
	--blueBtn: #3b82f6;
	--blueBtn-bottom: rgb(44, 78, 180);
}

:root[theme="dark"] {
	--background: #121212;
	--text: rgb(229, 229, 229);
	--box-main: #1d1d1d;
	--box-toggle: #191919;
	--box-separation: #2e2e2e;
	--box-toggleOn: #2e2e2e;
	--item-bg: #2c2e31;
	--box-shadow: none;
	--select: #252426;
	--greenBtn: #05aa76;
	--greenBtn-bottom: #047652;
	--redBtn: #c82b2d;
	--redBtn-bottom: #803334;
	--blueBtn: rgb(80, 140, 230);
	--blueBtn-bottom: rgb(44, 78, 180);
	--border: none;
}

:root[theme="frappe"] {
	--background: #232634;
	--text: #e2e8ff;
	--box-main: #303446;
	--box-toggle: #414559;
	--box-separation: #414559;
	--box-toggleOn: #607dc1;
	--item-bg: #414559;
	--select: #3b3e4a;
	--greenBtn: #78c346;
	--greenBtn-bottom: #597844;
	--redBtn: #d64d4f;
	--redBtn-bottom: #854243;
	--blueBtn: rgb(80, 128, 230);
	--blueBtn-bottom: rgb(44, 78, 180);
}
:root[theme="onedark"] {
	--background: #282c34;
	--text: #d2d6df;
	--box-main: #3a3d46;
	--box-toggle: #2f333d;
	--box-separation: #2f333d;
	--box-toggleOn: #13a3b7;
	--item-bg: #4d515d;
	--select: #262c33;
	--greenBtn: #85cf50;
	--greenBtn-bottom: #406923;
	--redBtn: #be2d39;
	--redBtn-bottom: #791a22;
	--blueBtn: rgb(80, 128, 230);
	--blueBtn-bottom: rgb(44, 78, 180);
}
:root[theme="matrix"] {
	--background: #0d0208;
	--text: #00ff41;
	--box-main: #0c2216;
	--box-toggle: #214338;
	--box-separation: #214338;
	--box-toggleOn: #24782e;
	--item-bg: #214338;
	--select: #08180f;
	--greenBtn: #19b42b;
	--greenBtn-bottom: #10701c;
	--redBtn: #19b42b;
	--redBtn-bottom: #10701c;
	--blueBtn: #19b42b;
	--blueBtn-bottom: #10701c;
}

:root[theme="github"] {
	--background: #f6f8fa;
	--text: #292d31;
	--box-main: #ffffff;
	--box-toggle: #f3f3f3;
	--box-separation: #f3f3f3;
	--box-toggleOn: #cce5ff;
	--item-bg: #3a66d150;
	--select: #cce5ff;
	--greenBtn: #0a9431;
	--greenBtn-bottom: #0c6826;
	--redBtn: #d73a49;
	--redBtn-bottom: #9b2733;
	--blueBtn: #005cc5;
	--blueBtn-bottom: #00428e;
}

:root[theme="latte"] {
	--background: #dce0e8;
	--text: #4c4f69;
	--box-main: #eff1f5;
	--box-toggle: #e6e9ef;
	--box-separation: #e6e9ef;
	--box-toggleOn: #cce5ff;
	--item-bg: #bcc0cc;
	--select: #cce5ff;
	--greenBtn: #40a02b;
	--greenBtn-bottom: #2e711f;
	--redBtn: #d20f39;
	--redBtn-bottom: #9c0c2b;
	--blueBtn: #1e66f5;
	--blueBtn-bottom: rgb(3, 49, 101);
}

:root[theme="solarized-dark"] {
	--background: #002b36;
	--text: #a4b1b3;
	--box-main: #003745;
	--box-toggle: #2e4c52;
	--box-separation: #2e4c52;
	--box-toggleOn: #005a6f;
	--item-bg: #003745;
	--select: rgb(9, 57, 53);
	--greenBtn: #859900;
	--greenBtn-bottom: rgb(73, 84, 1);
	--redBtn: #dc322f;
	--redBtn-bottom: #af2523;
	--blueBtn: #268bd2;
	--blueBtn-bottom: #2074b1;
}
:root[theme = "gruvbox"]{
	--background: #242424;
	--text: #fffefd;
	--box-main: #32302f;
	--box-toggle: #282828;
	--box-separation: #504945;
	--box-toggleOn: #458588;
	--item-bg: #4d515d;
	--select: #98971a;
	--greenBtn:#8ec07c;
	--greenBtn-bottom:#689D6A;
	--redBtn: #fb4934;
	--redBtn-bottom: #cc241d;
	--blueBtn: #7fa2ac;
	--blueBtn-bottom: #458588;

}

body {
	background-color: var(--background);
	color: var(--text);
	padding: 20px;
	font-size: x-large;
	text-align: left;
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
		Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
		sans-serif;
}
h1 {
	margin-top: 0;
	display: inline-block;
}
#version {
	margin: 5px;
}
input[type="text"],
.input {
	border-radius: 5px;
	padding: 5px;
	outline: none;
	border: none;
	width: 50%;
	height: 35px;
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
		Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
		sans-serif;
}
.input {
	width: 70px;
	font-size: larger;
	padding: 5px;
}

.prefBox,
#pathConfig {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin: 15px 15px;
	padding: 20px 15px;
	border-radius: 15px;
	background-color: var(--box-main);
}

#ytDlpArgBox {
	margin: 15px 15px;
	padding: 20px 15px;
	border-radius: 15px;
	background-color: var(--box-main);
}
#path {
	font-family: "JetBrains";
	font-size: medium;
}

#flatpakTxt {
	margin: 0 15px;
	padding: 20px 15px;
	cursor: pointer;
	text-decoration: underline;
	color: var(--blueBtn);
	display: none;
}

.prefBox {
	flex-direction: row;
}
#pathConfig {
	flex-direction: column;
}
.configBox {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	align-items: center;
	width: 100%;
}
#configBtn {
	display: inline-block;
}
#configOpts {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
}
#save {
	padding: 10px;
	border-radius: 8px;
	border: none;
	color: rgb(255, 255, 255);
	background-color: rgb(49, 215, 49);
	cursor: pointer;
}
#save:active {
	background-color: rgb(41, 155, 41);
}
#top {
	position: absolute;
	top: 10px;
	right: 10px;
	display: flex;
}
#back,
#restart {
	text-decoration: none;
	padding: 8px;
	border-radius: 10px;
	margin: 3px;
	font-size: large;
	cursor: pointer;
}
#back {
	background-color: var(--blueBtn);
	color: white;
}

#restart {
	background-color: var(--redBtn);
	color: white;
}
.redBtn {
	background-color: var(--redBtn);
	color: white;
	text-decoration: none;
	border: none;
	margin: 5px;
	border-radius: 10px;
	cursor: pointer;
	font-size: medium;
	padding: 5px;
}
a {
	color: rgb(29, 140, 209);
	cursor: pointer;
}

input[type="checkbox"] {
	width: 25px;
	height: 25px;
}

.greenBtn {
	padding: 10px;
	margin: 0 20px;
	border: none;
	border-radius: 10px;
	font-size: large;
	color: white;
	background-color: var(--greenBtn);
	cursor: pointer;
	position: relative;
	outline: none;
}
#selectLocation:active {
	border-bottom: none;
	top: 4px;
	margin-bottom: 4px;
}
select {
	padding: 15px;
	background-color: var(--select);
	color: var(--text);
	border: none;
	border-radius: 8px;
	cursor: pointer;
	font-size: large;
	outline: none;
	position: relative;
	width: 160px;
}
#browserInfo {
	cursor: pointer;
}

#configOpts {
	display: none;
}

body::-webkit-scrollbar {
	width: 10px;
}
body::-webkit-scrollbar-thumb {
	background: linear-gradient(rgb(110, 110, 110), rgb(77, 77, 77));
	border-radius: 8px;
}

#proxyTxt:valid {
	border: 2px solid var(--greenBtn);
}

#proxyTxt:invalid {
	border: 2px solid var(--redBtn);
}

#customArgsInput {
	padding: 8px;
	width: 94%;
	margin: auto;
	outline: none;
	font-family: "JetBrains";
	border-radius: 8px;
	resize: none;
	overflow: hidden;
}

.popup-container {
	position: fixed;
	bottom: 30px;
	left: 30px;
	z-index: 9999;

	display: flex;
	flex-direction: column;
	gap: 12px;
}

.popup-item {
	display: inline-block;

	color: #fff;
	padding: 12px 24px;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	font-weight: 600;
	font-size: 15px;

	opacity: 1;
	transition: opacity 0.4s;
}

================================================
FILE: assets/css/index.css
================================================
@font-face {
	font-family: "JetBrains";
	src: url("../fonts/JetBrainsMono-Regular.ttf") format("truetype");
}

@font-face {
	font-family: "Ubuntu";
	src: url("../fonts/Ubuntu-Regular.ttf") format("truetype");
}

@font-face {
	font-family: "Inter";
	src: url("../fonts/Inter.ttf") format("truetype");
}

:root[theme="light"] {
	--background: #f9fafb;
	--text: #1f2937;
	--box-main: #f3f4f6;
	--box-toggle: rgb(215 238 233);
	--box-separation: #e5e7eb;
	--box-toggleOn: rgb(127, 250, 172);
	--item-bg: #dddddd;
	--box-shadow: none;
	--select: #a7f3d0;
	--greenBtn: #22c55e;
	--greenBtn-bottom: #16a34a;
	--redBtn: #d64d4f;
	--redBtn-bottom: #854243;
	--blueBtn: #3b82f6;
	--blueBtn-bottom: rgb(44, 78, 180);
}

:root[theme="dark"] {
	--background: #121212;
	--text: rgb(229, 229, 229);
	--box-main: #1d1d1d;
	--box-toggle: #191919;
	--box-separation: #2e2e2e;
	--box-toggleOn: #2e2e2e;
	--item-bg: #2c2e31;
	--box-shadow: none;
	--select: #252426;
	--greenBtn: #05aa76;
	--greenBtn-bottom: #047652;
	--redBtn: #c82b2d;
	--redBtn-bottom: #803334;
	--blueBtn: rgb(80, 140, 230);
	--blueBtn-bottom: rgb(44, 78, 180);
	--border: none;
}

:root[theme="frappe"] {
	--background: #232634;
	--text: #e2e8ff;
	--box-main: #303446;
	--box-toggle: #414559;
	--box-separation: #414559;
	--box-toggleOn: #607dc1;
	--item-bg: #414559;
	--select: #3b3e4a;
	--greenBtn: #78c346;
	--greenBtn-bottom: #597844;
	--redBtn: #d64d4f;
	--redBtn-bottom: #854243;
	--blueBtn: rgb(80, 128, 230);
	--blueBtn-bottom: rgb(44, 78, 180);
}
:root[theme="onedark"] {
	--background: #282c34;
	--text: #d2d6df;
	--box-main: #3a3d46;
	--box-toggle: #2f333d;
	--box-separation: #2f333d;
	--box-toggleOn: #13a3b7;
	--item-bg: #4d515d;
	--select: #262c33;
	--greenBtn: #85cf50;
	--greenBtn-bottom: #406923;
	--redBtn: #be2d39;
	--redBtn-bottom: #791a22;
	--blueBtn: rgb(80, 128, 230);
	--blueBtn-bottom: rgb(44, 78, 180);
}
:root[theme="matrix"] {
	--background: #0d0208;
	--text: #00ff41;
	--box-main: #0c2216;
	--box-toggle: #214338;
	--box-separation: #214338;
	--box-toggleOn: #24782e;
	--item-bg: #214338;
	--select: #08180f;
	--greenBtn: #19b42b;
	--greenBtn-bottom: #10701c;
	--redBtn: #19b42b;
	--redBtn-bottom: #10701c;
	--blueBtn: #19b42b;
	--blueBtn-bottom: #10701c;
}

:root[theme="github"] {
	--background: #f6f8fa;
	--text: #292d31;
	--box-main: #ffffff;
	--box-toggle: #f3f3f3;
	--box-separation: #f3f3f3;
	--box-toggleOn: #cce5ff;
	--item-bg: #3a66d150;
	--select: #cce5ff;
	--greenBtn: #0a9431;
	--greenBtn-bottom: #0c6826;
	--redBtn: #d73a49;
	--redBtn-bottom: #9b2733;
	--blueBtn: #005cc5;
	--blueBtn-bottom: #00428e;
}

:root[theme="latte"] {
	--background: #dce0e8;
	--text: #4c4f69;
	--box-main: #eff1f5;
	--box-toggle: #e6e9ef;
	--box-separation: #e6e9ef;
	--box-toggleOn: #cce5ff;
	--item-bg: #bcc0cc;
	--select: #cce5ff;
	--greenBtn: #40a02b;
	--greenBtn-bottom: #2e711f;
	--redBtn: #d20f39;
	--redBtn-bottom: #9c0c2b;
	--blueBtn: #1e66f5;
	--blueBtn-bottom: rgb(3, 49, 101);
}

:root[theme="solarized-dark"] {
	--background: #002b36;
	--text: #a4b1b3;
	--box-main: #003745;
	--box-toggle: #2e4c52;
	--box-separation: #2e4c52;
	--box-toggleOn: #005a6f;
	--item-bg: #003745;
	--select: rgb(9, 57, 53);
	--greenBtn: #859900;
	--greenBtn-bottom: rgb(73, 84, 1);
	--redBtn: #dc322f;
	--redBtn-bottom: #af2523;
	--blueBtn: #268bd2;
	--blueBtn-bottom: #2074b1;
}
:root[theme = "gruvbox"]{
	--background: #242424;
	--text: #fffefd;
	--box-main: #32302f;
	--box-toggle: #282828;
	--box-separation: #504945;
	--box-toggleOn: #458588;
	--item-bg: #eebd35;
	--select: #98971a;
	--greenBtn:#8ec07c;
	--greenBtn-bottom:#689D6A;
	--redBtn: #fb4934;
	--redBtn-bottom: #cc241d;
	--blueBtn: #7fa2ac;
	--blueBtn-bottom: #458588;

}

body {
	font-family: "Ubuntu";
	text-align: center;
	padding: 10px;
	background-color: var(--background);
	color: var(--text);
	transition: 0.4s;
	font-size: large;
	user-select: none;
}

img {
	-webkit-user-drag: none;
}

#popupBox,
#popupBoxMac {
	width: 100vw;
	height: 100vh;
	margin: 0;
	background-color: rgba(17, 25, 40, 0.75);
	position: absolute;
	top: 0;
	left: 0;
	z-index: 2;
	display: none;
}
#popup,
#popupMac {
	position: absolute;
	padding: 20px;
	top: 50%;
	left: 50%;
	width: 300px;
	border-radius: 10px;
	transform: translate(-50%, -50%);
	background-color: rgb(91, 91, 91);
	color: white;
}

#tryBtn {
	background-color: rgb(137, 226, 255);
	color: rgb(35, 35, 35);
	border: none;
	padding: 10px;
	border-radius: 10px;
	cursor: pointer;
	position: relative;
}
#tryBtn:active {
	border: none;
}

#menuIcon {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 40px;
	height: 40px;
	cursor: pointer;
	transition: 0.3s;
}

#menu {
	display: none;
	flex-direction: column;
	backdrop-filter: blur(18px) saturate(180%);
	-webkit-backdrop-filter: blur(18px) saturate(180%);
	background: rgba(15, 23, 42, 0.85);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 16px;
	position: absolute;
	top: 45px;
	right: 50px;
	padding: 12px;
	width: 220px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
	text-align: left;
	font-family: "Inter", sans-serif;
	font-size: medium;
	color: #e2e8f0;
	z-index: 2;
	animation: fadeIn 0.25s ease-out;
}

.menuItem {
	cursor: pointer;
	padding: 10px 12px;
	border-radius: 8px;
	margin-bottom: 6px;
	text-decoration: none;
	color: #d6dadf;
	transition: all 0.15s ease-in-out;
	border-bottom: none;
	background: rgba(25, 37, 66, 0.223);
}

.menuItem:hover {
	background: rgba(255, 255, 255, 0.08);
	color: #38bdf8;
	transform: translateX(2px);
}

.menuDivider {
	height: 1px;
	background: rgba(255, 255, 255, 0.08);
	margin: 4px 0;
}

.menuLabel {
	margin-top: 5px;
	font-size: 0.9rem;
	color: #94a3b8;
	padding: 4px 0;
}

.themeSelect {
	margin-top: 4px;
	background: rgba(30, 41, 59, 0.9);
	color: #f8fafc;
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: 8px;
	padding: 8px;
	font-family: "Inter", sans-serif;
	transition: border 0.2s, background 0.2s;
	width: 100%;
	cursor: pointer;
}

.themeSelect:hover,
.themeSelect:focus {
	border-color: #38bdf8;
	background: rgba(51, 65, 85, 0.9);
	outline: none;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(-6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.item {
	display: flex;
	position: relative;
	width: 86%;
	background-color: var(--item-bg);
	color: var(--text);
	margin: 10px auto;
	border-radius: 10px;
	padding: 10px;
	align-items: center;
	justify-content: space-between;
}
.playlistItem {
	display: flex;
	position: relative;
	width: 94%;
	height: 25px;
	background-color: var(--item-bg);
	color: var(--text);
	padding: 16px 25px;
	border-radius: 15px;
	align-items: center;
	justify-content: space-between;
	margin: 10px auto;
}

.itemIconBox {
	display: flex;
	flex-direction: column;
}
.itemIcon {
	max-width: 160px;
	max-height: 90px;
	border-radius: 10px;
	margin: 0 10px 0 0;
}

.title {
	padding: 12px 10px;
	border-radius: 8px;
	margin-left: 4px;
	border: none;
	outline: none;
	width: 50%;
	text-align: center;
	background-color: var(--box-separation);
	color: var(--text);
	font-size: large;
	font-family: "Ubuntu";
}

.itemTitle {
	padding: 5px;
}
.itemBody {
	height: 90%;
	width: 100%;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}
.itemProgress {
	font-weight: bold;
	cursor: pointer;
	padding: 10px 0;
}

.custom-progress {
    width: 90%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
	display:inline-block;
}

.custom-progress-fill {
    width: 0%;
    height: 100%;
    background: var(--blueBtn);
    transition: width 0.3s ease;
    border-radius: 6px 0 0 6px;
}


.itemSpeed {
	padding: 10px 5px 5px 5px;
}
.itemClose {
	position: absolute;
	top: 8px;
	right: 8px;
	cursor: pointer;
	cursor: pointer;
	width: 20px;
	height: 20px;
}
.itemType {
	font-style: italic;
	margin-top: 5px;
	margin: top 8px;
}

#closeHidden {
	bottom: 7px;
	position: absolute;
	right: 10px;
	cursor: pointer;
	cursor: pointer;
	width: 20px;
	height: 20px;
}

#hidden {
	display: none;
	position: absolute;
	z-index: 1;
	left: 0;
	right: 0;
	margin: auto;
	top: 20%;
	background-color: var(--box-main);
	border-radius: 15px;
	width: 80%;
	padding: 10px 10px 25px 10px;
	color: var(--text);
	border: var(--border);
}

#videoBox,
#audioBox {
	background-color: var(--box-toggle);
	padding: 10px;
	border-radius: 10px;
}

#audioExtract,
.separationBox {
	margin: 10px;
	padding: 10px;
	background-color: var(--box-separation);
	border-radius: 10px;
}

#options {
	display: none;
	position: absolute;
	overflow: hidden;
	z-index: 1;
	left: 0;
	right: 0;
	margin: auto;
	top: 15%;
	background-color: var(--box-main);
	width: 80%;
	border-radius: 10px;
	padding: 10px;
	color: var(--text);
}

#btnContainer {
	display: flex;
	flex-direction: row;
	justify-content: center;
	padding-top: 10px;
}

.toggleBtn {
	width: 50%;
	font-size: x-large;
	border: var(--border);
	background-color: var(--box-toggle);
	border-radius: 10px;
	cursor: pointer;
	padding: 8px;
	color: var(--text);
}
#videoToggle {
	background-color: var(--box-toggleOn);
}

.select {
	padding: 12px 15px;
	background-color: var(--select);
	color: var(--text);
	border: none;
	border-radius: 12px;
	cursor: pointer;
	font-size: large;
	margin-bottom: 8px;
	margin-left: 8px;
	outline: none;
	max-width: min(400px, 100%);
	font-family: "JetBrains";
}

.audioSelect {
	width: 180px;
}

#videoTypeSelect {
	width: 160px;
}

#audioQualitySelect {
	width: 145px;
}

#link {
	padding: 10px;
}

#videoFormatSelect,
#audioFormatSelect,
#audioForVideoFormatSelect {
	font-family: JetBrains, monospace;
	font-size: medium;
	width: 400px;
}

.formatSelect {
	margin-right: 4px;
}

label {
	position: relative;
	top: 3px;
}

#videoList,
#audioList {
	display: none;
}

.cb {
	width: 20px;
	height: 20px;
	position: relative;
	left: 5px;
	top: 4px;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
	appearance: none;
}

.submitBtn {
	padding: 15px;
	border-radius: 10px;
	background-color: var(--greenBtn);
	color: white;
	border: none;
	font-size: large;
	cursor: pointer;
	display: inline-block;
	outline: none;
	position: relative;
}
.submitBtn:active {
	background-color: var(--greenBtn-bottom);
	border: none;
}

#pasteUrl,
#pasteLink {
	--greenTop: #34d399;
	--greenBottom: #059669;
	--greenHover: #10b981;
	--greenActive: #047857;

	background: linear-gradient(
		to bottom right,
		var(--greenTop),
		var(--greenBottom)
	);
	color: #fff;
	font-size: 1.1rem;
	padding: 16px 28px;
	border: none;
	border-radius: 16px;
	cursor: pointer;
	outline: none;
	position: relative;
	transition: all 0.25s ease;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
	margin-top: 15px;
	font-weight: bold;
}

#pasteUrl:hover,
#pasteLink:hover {
	background: linear-gradient(
		to bottom right,
		var(--greenHover),
		var(--greenBottom)
	);
	transform: translateY(-2px);
}

#pasteUrl:active,
#pasteUrl.active,
#pasteLink:active {
	background: linear-gradient(
		to bottom right,
		var(--greenActive),
		var(--greenBottom)
	);
	transform: translateY(0);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) inset;
}

.paste-keys {
	margin-left: 4px;
}

.paste-keys .key {
	background: rgba(255, 255, 255, 0.128);
	border-radius: 8px;
	padding: 6px 10px;
	font-size: 15px;
	font-family: "Inter", sans-serif;
	color: #e5e5e5;
	margin: 0 3px;
	border-bottom: 3px solid rgba(2, 107, 72, 0.6);
}

.resumeBtn {
	padding: 10px;
	border-radius: 8px;
	background-color: rgb(64, 227, 64);
	color: white;
	border: none;
	cursor: pointer;
	display: inline-block;
	outline: none;
	position: absolute;
	right: 10px;
	bottom: 10px;
	width: 100px;
}

.input {
	padding: 8px;
	border: none;
	outline: none;
	border-radius: 5px;
	width: 70px;
	font-size: large;
	margin: 5px;
}

#incorrectMsg,
#incorrectMsgPlaylist {
	color: var(--redBtn);
}

#incorrectMsgPlaylist {
	display: none;
}

#errorBtn {
	display: none;
}
#errorDetails {
	cursor: pointer;
	font-family: monospace;
	padding: 15px;
	margin: 10px 0;
	border: 2px solid rgb(189, 0, 0);
	border-radius: 8px;
	display: none;
	transition: 0.5s all;
}
#loadingWrapper {
	/* Default is flex */
	display: none;
	flex-direction: row;
	justify-content: center;
	align-items: center;
}

#preparingBox {
	display: none;
	flex-direction: row;
	justify-content: center;
	align-items: center;
}

svg {
	width: 100px;
	height: 100px;
	display: inline-block;
	margin-left: 20px;
}

.savedMsg {
	color: rgb(52, 170, 234);
	cursor: pointer;
}
#savedMsg {
	cursor: pointer;
}
button {
	font-family: "Ubuntu";
	font-weight: bold;
	outline: none;
}

#extractBtn,
.blueBtn {
	color: white;
	background-color: var(--blueBtn);
	border: none;
	position: relative;
	padding: 15px;
	border-radius: 10px;
	cursor: pointer;
	margin: 8px;
	font-size: large;
	text-decoration: none;
}

#extractBtn {
	width: 150px;
}

#download,
#audioDownload {
	width: 140px;
}

#clearBtn {
	display: none;
}

#extractBtn:active,
.blueBtn:active {
	background-color: var(--blueBtn-bottom);
	border: none;
}

.advancedToggle {
	color: white;
	background-color: var(--redBtn);
	border: none;
	position: relative;
	padding: 15px;
	border-radius: 10px;
	cursor: pointer;
	margin: 8px;
	font-size: large;
}

.advancedToggle:active {
	background-color: var(--blueBtn-bottom);
	border: none;
}

#advanced {
	display: none;
}
.advancedItem {
	border-radius: 15px;
	padding: 20px;
	margin: 10px;
	background-color: var(--item-bg);
}

#path {
	font-family: "JetBrains";
	font-size: medium;
}

#subHeader {
	font-weight: bold;
	margin-top: 0;
}

h2 {
	margin: 12px;
	font-size: 24px;
}

/* Scrollbar */

body::-webkit-scrollbar {
	width: 5px;
}

body::-webkit-scrollbar-track {
	box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}

body::-webkit-scrollbar-thumb {
	background-color: rgb(79, 78, 78);
	border-radius: 5px;
}

#goToTop {
	display: none;
	position: fixed;
	bottom: 10px;
	right: 10px;
	z-index: 2;
	border: none;
	outline: none;
	background-image: url(../images/up-arrow.png);
	background-size: contain;
	width: 40px;
	height: 40px;
	cursor: pointer;
	color: white;
	cursor: pointer;
}

.popup-container {
	position: fixed;
	bottom: 30px;
	left: 30px;
	z-index: 9999;

	display: flex;
	flex-direction: column;
	gap: 12px;
}

.popup-item {
	display: inline-block;

	color: #fff;
	padding: 12px 24px;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	font-weight: 600;
	font-size: 15px;

	opacity: 1;
	transition: opacity 0.4s;
}

.scale {
	animation-name: scale;
	animation-duration: 0.4s;
	animation-fill-mode: forwards;
}

.scaleUp {
	animation-name: scaleUp;
	animation-duration: 0.4s;
	animation-fill-mode: forwards;
}

body::-webkit-scrollbar {
	width: 10px;
}
body::-webkit-scrollbar-thumb {
	background: linear-gradient(rgb(110, 110, 110), rgb(77, 77, 77));
	border-radius: 8px;
}

@keyframes scale {
	0% {
		scale: 1;
	}
	100% {
		scale: 0;
	}
}
@keyframes scaleUp {
	0% {
		scale: 0;
	}
	100% {
		scale: 1;
	}
}

@media screen and (max-width: 650px) {
	.item {
		width: 90%;
	}
	.title {
		width: 80%;
	}
}

/* Compressor styles */
#compressor-header {
	text-align: center;
	margin-top: 0;
}

.container {
	max-width: 800px;
	margin: 30px auto 10px auto;
	background: var(--box-main);
	padding: 30px;
	border-radius: 8px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.drop-zone {
	border: 2px dashed #ccc;
	border-radius: 8px;
	padding: 2rem;
	text-align: center;
	margin-bottom: 2rem;
	transition: border-color 0.3s ease;
	background: var(--box-toggle);
}

.drop-zone:hover {
	border-color: #2196f3;
	cursor: pointer;
}

.compress-select {
	font-family: "Ubuntu";
	padding: 10px;
}

.drop-zone.dragover {
	border-color: #2196f3;
	background-color: var(--box-toggleOn);
}

#settings-group-container {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
}

.output-folder-conf {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

#output-folder-box {
	background-color: var(--box-toggle);
	margin-bottom: 12px;
	padding: 15px;
	border-radius: 8px;
	text-align: left;
}

#output-folder-input {
	width: 20px;
	height: 20px;
	margin-left: 10px;
}

.folder-input-checkbox {
	display: flex;
	align-items: center;
}
#output-suffix {
	cursor: text;
}

.settings-group {
	margin-bottom: 10px;
	display: flex;
	flex-direction: column;
	width: 46%;
}

.compress-label {
	font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
	display: block;
	margin-bottom: 10px;
	font-weight: 500;
	text-align: left;
}

#compression-status {
	max-width: 800px;
	margin: 20px auto 0 auto;
	border-top: 1px solid var(--item-bg);
	padding-top: 20px;
}

.status-item {
	padding: 16px;
	margin: 6px auto;
	border-radius: 4px;
	display: flex;
	justify-content: space-between;
	flex-direction: row;
	background-color: var(--item-bg);
	max-width: 800px;
}

.status-item.success {
	color: var(--greenBtn);
}

.status-item.error {
	color: var(--redBtn);
}

.status {
	min-width: 80px;
	text-transform: uppercase;
	font-size: 0.9em;
	font-weight: bold;
}

.fileinput-btn {
	background: var(--blueBtn);
	color: white;
	padding: 10px;
	display: block;
	border-radius: 5px;
	margin: 5px 0 10px 0;
	cursor: pointer;
	border: none;
}

.progressBarCompress {
	width: 200px;
}

.nvidia_opt,
.amf_opt,
.qsv_opt,
.vaapi_opt,
.videotoolbox_opt {
	display: none;
}

#custom-folder-select {
	padding: 10px;
	margin-left: 0;
	display: none;
}

#custom-folder-path {
	font-family: "JetBrains";
	background-color: var(--box-main);
	padding: 8px;
	border-radius: 4px;
	display: none;
}

#selected-files {
	padding-top: 10px;
	opacity: 0.8;
}

::view-transition-old(root),
::view-transition-new(root) {
	animation: none;
	mix-blend-mode: normal;
}

@media (min-width: 640px) {
	.container {
		padding: 2rem;
	}
}

.slider-wrapper {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.time-display {
	flex-shrink: 0;
	width: 5.5rem;
	height: 3rem;
	background-color: var(--box-main);
	color: var(--text);
	border-radius: 0.5rem;
	font-weight: 500;
	border: none;
	outline: none;
	text-align: center;
	font-family: "Inter", sans-serif;
	font-size: 1rem;
	padding: 0;
}

.slider-container {
	position: relative;
	width: 100%;
	height: 2rem;
	display: flex;
	align-items: center;
}

.track-background {
	position: absolute;
	width: 100%;
	height: 0.25rem;
	background-color: #4b5563;
	border-radius: 9999px;
}

#range-highlight {
	position: absolute;
	height: 0.25rem;
	background-color: var(--blueBtn);
	border-radius: 9999px;
	z-index: 1;
}

input[type="range"] {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 4px;
	background: transparent;
	outline: none;
	position: absolute;
	margin: 0;
	padding: 0;
	pointer-events: none;
}

#min-slider {
	z-index: 2;
}

#max-slider {
	z-index: 3;
}

input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 12px;
	height: 32px;
	background-color: var(--blueBtn);
	border-radius: 9999px;
	cursor: pointer;
	pointer-events: auto;
	margin-top: -14px;
	transition: transform 0.1s ease-in-out;
	position: relative;
}

input[type="range"]::-webkit-slider-thumb:hover {
	transform: scale(1.1);
}

#customArgsInput {
	padding: 8px;
	width: 94%;
	margin: auto;
	outline: none;
	font-family: "JetBrains";
	border-radius: 8px;
	resize: vertical;
}

#updatePopup {
	position: fixed;
	bottom: 30px;
	right: 30px;
	z-index: 9999;
	background-color: var(--box-separation);
	padding: 15px 20px;
	border-radius: 10px;
	display: none;

	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.progress-track {
	width: 200px;
	height: 8px;
	background-color: rgba(209, 209, 209, 0.446);
	border-radius: 4px;
	overflow: hidden;
	margin: 10px 2px;
}

#progressBarFill {
	height: 100%;
	width: 0%;
	background-color: var(--greenBtn);
	transition: width 0.2s ease;
}

.update-label,
#updateProgress {
	font-size: 14px;
}


================================================
FILE: crowdin.yml
================================================
files:
  - source: /translations/en.json
    translation: /translations/%locale%.json


================================================
FILE: flatpak/io.github.aandrew_me.ytdn.desktop
================================================
[Desktop Entry]
Name=ytDownloader
Comment=Download videos and audios from YouTube and other sites
Exec=run.sh
Type=Application
Icon=io.github.aandrew_me.ytdn
Categories=Utility;


================================================
FILE: flatpak/io.github.aandrew_me.ytdn.metainfo.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
  <id>io.github.aandrew_me.ytdn</id>
  <name>ytDownloader</name>
  <launchable type="desktop-id">io.github.aandrew_me.ytdn.desktop</launchable>
  <developer id="io.github.aandrew_me">
    <name>Andrew</name>
  </developer>
  <url type="bugtracker">https://github.com/aandrew-me/ytDownloader/issues</url>
  <url type="translate">
    https://github.com/aandrew-me/ytDownloader?tab=readme-ov-file#internationalization-localization-</url>
  <summary>Download videos and audios from hundreds of sites</summary>
  <description>
    <p>ytDownloader (Formerly know as Youtube Downloader Plus) lets you download videos and audios
      of different qualities from hundreds of
      sites including the popular ones but not limited to Youtube, Facebook, Instagram, Tiktok,
      Twitter, Twitch and so on.</p>
    <p>✔️ Supports high quality video resolutions</p>
    <p>✔️ Video Compressor with Hardware Acceleration</p>
    <p>✔️ Supports audio extraction in multiple formats</p>
    <p>✔️ Supports playlist downloads</p>
    <p>✔️ Supports downloading particular ranges</p>
    <p>✔️ Supports downloading subtitles</p>
    <p>✔️ Supports multiple themes</p>
    <p>✔️ Completely free and open source</p>
    <p>✔️ Fast download speeds</p>
  </description>
  <project_license>GPL-3.0</project_license>
  <metadata_license>CC0-1.0</metadata_license>
  <screenshots>
    <screenshot type="default">
      <image>
        https://github.com/user-attachments/assets/12410bca-31c3-48a0-bbd3-1d74bcc752b6
      </image>
      <caption>ytDownloader homepage</caption>
    </screenshot>

    <screenshot>
      <image>
        https://github.com/user-attachments/assets/060557bc-d209-4bd0-bda4-debe42ca83a0
      </image>
      <caption>ytDownloader Settings</caption>
    </screenshot>

    <screenshot>
      <image>
        https://github.com/user-attachments/assets/52da7e50-46bb-4749-8152-5e79324a6cc3
      </image>
      <caption>ytDownloader video compressor</caption>
    </screenshot>

  </screenshots>
  <url type="homepage">https://github.com/aandrew-me/ytDownloader</url>

  <content_rating type="oars-1.1" />

  <releases>
    <release version="3.20.2" date="2025-11-27">
      <description>
        <p>Bring back cookie related info</p>
      </description>
    </release>


    <release version="3.20.0" date="2025-11-22">
      <description>
        <p>Added download history</p>
        <p>Added JS runtime support as per new yt-dlp requirements. The app will now ship with a
          nodejs binary. Youtube downloads should be more stable.</p>
        <p>Added slider for range selection.</p>
        <p>Added progress for yt-dlp download and update</p>
        <p>Translation updates, added new languages.</p>
        <p>Added custom built ffmpeg, ffprobe for Windows and Linux builds.</p>
        <p>Added support to add custom yt-dlp arguments</p>
        <p>Fixed incorrect resolution downloads for playlists.</p>
        <p>Added showing approximate file sizes when possible.</p>
        <p>Improved user interface.</p>
        <p>Minor bug fixes.</p>
        <p>Major code refactoring.</p>
      </description>
    </release>

    <release version="3.19.2" date="2025-09-06">
      <description>
        <p>Improved app performance</p>
        <p>UI improvements</p>
        <p>Fixed minor bugs</p>
      </description>
    </release>
    <release version="3.19.1" date="2025-05-20">
      <description>
        <p>Added support for chapters</p>
        <p>UI improvements</p>
      </description>
    </release>
    <release version="3.19.0" date="2025-02-09">
      <description>
        <p>Added Video Compressor with Hardware Acceleration (Beta)</p>
        <p>Bug fixes</p>
      </description>
    </release>
    <release version="3.18.5" date="2024-11-29">
      <description>
        <p>Bug fixes</p>
      </description>
    </release>
    <release version="3.18.4" date="2024-11-3">
      <description>
        <p>Bug fixes</p>
      </description>
    </release>
    <release version="3.18.3" date="2024-10-10">
      <description>
        <p>Fixes and enhancements</p>
      </description>
    </release>
    <release version="3.18.2" date="2024-8-25">
      <description>
        <p>Design enhancements</p>
        <p>Added removal of old windows updates</p>
        <p>Ignore unavailable videos for playlists</p>
        <p>Fixed issues with config file on resize</p>
      </description>
    </release>
    <release version="3.18.0" date="2024-6-02">
      <description>
        <p>Added proxy support</p>
        <p>Added button to clear downloads</p>
        <p>Fixed download errors</p>
        <p>Added compatibility for X(Twitter)</p>
        <p>Minor enhancements</p>
      </description>
    </release>
    <release version="3.17.4" date="2024-4-21">
      <description>
        <p>Added Chinese language</p>
        <p>Fixed video trim info to filename</p>
      </description>
    </release>
    <release version="3.17.3" date="2024-3-03">
      <description>
        <p>Fixed formats not being shown</p>
        <p>Added Arabic language</p>
      </description>
    </release>
    <release version="3.17.2" date="2024-2-23">
      <description>
        <p>Fixed conflicts with same filenames</p>
        <p>Fixed formats not being selected properly</p>
      </description>
    </release>
    <release version="3.17.1" date="2024-1-27">
      <description>
        <p>Fixed config file not being used when getting info</p>
      </description>
    </release>
    <release version="3.17.0" date="2024-1-27">
      <description>
        <p>Changelog</p>
        <ul>
          <li>Added option to choose audio for video</li>
          <li>Webm options will be hidden by default</li>
          <li>Enhancements</li>
        </ul>
      </description>
    </release>
    <release version="3.16.1" date="2023-12-26" />
    <release version="3.16.0" date="2023-12-24" />
    <release version="3.15.1" date="2023-11-26" />
    <release version="3.15.0" date="2023-10-29" />
    <release version="3.14.3" date="2023-10-21" />
    <release version="3.14.2" date="2023-8-8" />
    <release version="3.14.1" date="2023-6-11" />
    <release version="3.14.0" date="2023-5-17" />
    <release version="3.13.0" date="2023-4-25" />
    <release version="3.12.2" date="2023-4-8" />
    <release version="3.12.1" date="2023-3-24" />
    <release version="3.12.0" date="2023-2-26" />
    <release version="3.11.0" date="2023-1-30" />
    <release version="3.10.6" date="2023-1-24" />
    <release version="3.10.5" date="2023-1-22" />
    <release version="3.10.4" date="2023-1-19" />
    <release version="3.10.3" date="2023-1-16" />
    <release version="3.10.2" date="2023-1-3" />
    <release version="3.10.1" date="2022-12-26" />
    <release version="3.10.0" date="2022-12-24" />
    <release version="3.9.0" date="2022-11-27" />
    <release version="3.8.1" date="2022-11-20" />
    <release version="3.8.0" date="2022-11-12" />
    <release version="3.7.2" date="2022-11-10" />
    <release version="3.7.1" date="2022-11-1" />
    <release version="3.7.0" date="2022-11-1" />
    <release version="3.6.3" date="2022-10-27" />
    <release version="3.6.2" date="2022-10-13" />
    <release version="3.6.1" date="2022-10-03" />
    <release version="3.6.0" date="2022-10-03" />
    <release version="3.5.3" date="2022-09-23" />
    <release version="3.5.2" date="2022-09-22" />
    <release version="3.5.1" date="2022-09-18" />
    <release version="3.5.0" date="2022-09-18" />
    <release version="3.4.0" date="2022-09-14" />
    <release version="3.3.3" date="2022-09-14" />
    <release version="3.3.2" date="2022-09-13" />
    <release version="3.3.1" date="2022-09-10" />
    <release version="3.3.0" date="2022-09-8" />
    <release version="3.2.2" date="2022-09-7" />
    <release version="3.2.1" date="2022-09-6" />
    <release version="3.2.0" date="2022-09-5" />
    <release version="3.1.0" date="2022-08-31" />
    <release version="3.0.0" date="2022-08-29" />
    <release version="2.1.2" date="2022-08-28" />
    <release version="2.1.1" date="2022-08-27" />
    <release version="2.1.0" date="2022-08-27" />
    <release version="2.0.4" date="2022-08-26" />
    <release version="2.0.3" date="2022-08-23" />
    <release version="2.0.1" date="2022-08-10" />
    <release version="2.0" date="2022-08-05" />
  </releases>
</component>

================================================
FILE: html/about.html
================================================
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title data-translate="about">About</title>
    <link rel="stylesheet" href="../assets/css/extra.css">

    <script src="../translations/i18n-init.js" defer></script>
</head>

<body>
    <div id="top">
        <a id="back" data-translate="homepage">Homepage</a>
    </div>
    <h1>ytDownloader </h1><span id="version"></span>

    <p id="txt1" data-translate="appDescription">ytDownloader lets you download videos and audios from hundreds of sites
        like Youtube, Facebook,
        Instagram, Tiktok, Twitter and so on</p>

    <p id="txt2" data-translate="aboutAppDescription">It's a Free and Open Source app built on top of Node.js and
        Electron. yt-dlp has been used for
        downloading</p>

    <span id="txt3" data-translate="sourceCodeAvailable">Source Code is available </span><a id="sourceLink"
        data-translate="here">here</a>

    <script>
        const { ipcRenderer, shell } = require("electron");


        document.addEventListener('translations-loaded', () => {
            window.i18n.translatePage();

            const storageTheme = localStorage.getItem("theme");
            if (storageTheme) {
                document.documentElement.setAttribute("theme", storageTheme);
            } else {
                document.documentElement.setAttribute("theme", "frappe");

            }

            ipcRenderer.send("get-version");
            ipcRenderer.once("version", (event, version) => {
                document.getElementById("version").textContent = version;
            });

            document.getElementById("back").addEventListener("click", () => {
                ipcRenderer.send("close-secondary");
            });

            document.getElementById("sourceLink").addEventListener("click", () => {
                shell.openExternal("https://github.com/aandrew-me/ytDownloader");
            });
        });
    </script>

</body>

</html>

================================================
FILE: html/compressor.html
================================================
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title data-translate="compressor">Video Compressor</title>
    <link rel="stylesheet" href="../assets/css/index.css">
    <script src="../translations/i18n-init.js" defer></script>
    <script src="../src/compressor.js" defer></script>
</head>

<body id="compressor_body">
    <!-- Menu icon -->
    <img src="../assets/images/menu.png" alt="menu" id="menuIcon">

    <!-- Menu -->
    <div id="menu" class="menu">
        <a id="homeWin" class="menuItem" data-translate="homepage">Homepage</a>
        <a id="playlistWin" class="menuItem" data-translate="downloadPlaylistButton">Download Playlist</a>
        <a id="preferenceWin" class="menuItem" data-translate="preferences">Preferences</a>
        <a id="historyWin" class="menuItem" data-translate="downloadHistory">History</a>
        <a id="aboutWin" class="menuItem" data-translate="about">About</a>

        <div class="menuDivider"></div>

        <label for="themeToggle" id="themeTxt" class="menuLabel" data-translate="theme">Theme</label>
        <select name="themeToggle" id="themeToggle" class="themeSelect">
            <option id="lightTxt" value="light" data-translate="themeLight">Light</option>
            <option id="darkTxt" value="dark" data-translate="themeDark">Dark</option>
            <option id="frappeTxt" value="frappe" data-translate="themeFrappe">Frappé</option>
            <option id="onedarkTxt" value="onedark" data-translate="themeOneDark">One dark</option>
            <option id="matrixTxt" value="matrix" data-translate="themeMatrix">Matrix</option>
            <option id="githubTxt" value="github">Github</option>
            <option id="latteTxt" value="latte">Latte</option>
            <option id="solarizedDarkTxt" value="solarized-dark" data-translate="themeSolarizedDark">Solarized Dark</option>
            <option id="gruvboxTxt" value="gruvbox">Gruvbox</option>
        </select>
    </div>

    <div class="container">
        <h1 id="compressor-header" data-translate="compressor">Video Compressor</h1>

        <div class="drop-zone">
            <p data-translate="dragAndDropFiles">Drag and drop file(s)</p>
            <input type="file" id="fileInput" multiple hidden>
            <label for="fileInput" class="fileinput-btn" data-translate="chooseFiles">Choose File(s)</label>
            <div id="selected-files" data-translate="noFilesSelected">No files selected</div>
        </div>

        <div id="settings-group-container">
            <div class="settings-group">
                <label class="compress-label" for="extension" data-translate="videoFormat">Video format</label>
                <select class="select compress-select" id="file_extension">
                    <option value="unchanged">Unchanged</option>
                    <option value="mp4">mp4</option>
                    <option value="mkv">mkv</option>
                </select>
            </div>

            <div class="settings-group">
                <label class="compress-label" for="encoder" data-translate="videoEncoder">Video Encoder</label>
                <select class="select compress-select" id="encoder">
                    <option value="x264">x264</option>
                    <option value="x265">x265</option>
                    <option class="qsv_opt" value="qsv">x264 (Intel QSV Hardware Acceleration)</option>
                    <option class="qsv_opt" value="hevc_qsv">x265 (Intel QSV Hardware Acceleration)</option>
                    <option class="amf_opt" value="amf">x264 (AMD Hardware Acceleration)</option>
                    <option class="amf_opt" value="hevc_amf">x265 (AMD Hardware Acceleration)</option>
                    <option class="nvidia_opt" value="nvenc">x264 (NVIDIA Hardware Acceleration)</option>
                    <option class="nvidia_opt" value="hevc_nvenc">x265 (NVIDIA Hardware Acceleration)</option>
                    <option class="vaapi_opt" value="vaapi">x264 (VA-API Hardware Acceleration)</option>
                    <option class="vaapi_opt" value="hevc_vaapi">x265 (VA-API Hardware Acceleration)</option>
                    <option class="videotoolbox_opt" value="videotoolbox">x264 (VideoToolbox Hardware Acceleration)
                    </option>
                    <option class="videotoolbox_opt" value="hevc_videotoolbox">x265 (VideoToolbox Hardware Acceleration)
                    </option>
                    <option value="copy">Copy video</option>
                </select>
            </div>

            <div class="settings-group">
                <label class="compress-label" for="compression-speed" data-translate="compressionSpeed">Compression
                    Speed</label>
                <select class="select compress-select" id="compression-speed">
                    <option value="fast">Fast</option>
                    <option selected value="medium">Medium</option>
                    <option value="slow">Slow</option>
                </select>
            </div>

            <div class="settings-group">
                <label class="compress-label" for="video-quality" data-translate="videoQuality">Video Quality</label>
                <select class="select compress-select" id="video-quality">
                    <option value="18">18 (Best quality)</option>
                    <option value="19">19</option>
                    <option value="20">20</option>
                    <option value="21">21</option>
                    <option value="22">22</option>
                    <option selected value="23">23 (Medium size, good quality)</option>
                    <option value="24">24</option>
                    <option value="25">25</option>
                    <option value="26">26</option>
                    <option value="27">27</option>
                    <option value="28">28 (Smaller file size, decent quality)</option>
                    <option value="29">29</option>
                    <option value="30">30</option>
                    <option value="31">31</option>
                    <option value="32">32</option>
                    <option value="33">33</option>
                    <option value="34">34</option>
                    <option value="35">35</option>
                    <option value="36">36</option>
                    <option value="37">37</option>
                    <option value="38">38</option>
                    <option value="39">39</option>
                    <option value="40">40</option>
                    <option value="41">41</option>
                    <option value="42">42</option>
                    <option value="43">43</option>
                    <option value="44">44</option>
                    <option value="45">45</option>
                    <option value="46">46</option>
                    <option value="47">47</option>
                    <option value="48">48</option>
                    <option value="49">49</option>
                    <option value="50">50</option>
                    <option value="51">51 (Worst quality)</option>
                </select>

            </div>

            <div class="settings-group">
                <label class="compress-label" for="audio-format" data-translate="audioFormat">Audio Format</label>
                <select class="select compress-select" id="audio-format">
                    <option value="copy">Unchanged</option>
                    <option value="aac">aac</option>
                    <option value="mp3">mp3</option>
                </select>
            </div>

            <div class="settings-group">
                <div class="compress-label" data-translate="outputSuffix">Output suffix</div>
                <input type="text" name="suffix" id="output-suffix" class="select compress-select"
                    placeholder="No suffix needs different output folder" value="_compressed">
            </div>
        </div>

        <div id="output-folder-box">
            <div class="output-folder-conf">
                <span class="compress-label" data-translate="outputInSameFolder">Output in same folder</span>
                <input checked type="checkbox" name="output-folder" id="output-folder-input">

            </div>
            <div class="output-folder-conf">
                <button class="blueBtn" id="custom-folder-select" data-translate="selectCustomFolder">Select Custom
                    Folder</button>
                <span id="custom-folder-path"></span>
            </div>
        </div>

        <div class="button-group">
            <button class="blueBtn" id="compress-btn" data-translate="startCompression">Start Compression</button>
            <button class="advancedToggle" id="cancel-btn" data-translate="cancel">Cancel</button>
        </div>

    </div>

    <div id="compression-status"></div>
    </div>

</body>

</html>

================================================
FILE: html/history.html
================================================
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Download History - YtDownloader</title>
    <link rel="stylesheet" href="../assets/css/index.css">
    <style>
        .history-container {
            padding: 20px;
            max-width: 1200px;
            margin: 0 auto;
        }

        .history-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
            flex-wrap: wrap;
            gap: 15px;
        }

        .history-header h1 {
            margin: 0;
            font-size: 32px;
            font-weight: 700;
            color: var(--text);
        }

        .history-controls {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
            align-items: center;
            margin-bottom: 25px;
        }

        .search-box {
            padding: 10px 15px;
            border: 2px solid var(--box-toggle, #3a3a3a);
            border-radius: 6px;
            background: var(--box-main, #2a2a2a);
            color: var(--text, #fff);
            width: 300px;
            font-size: 14px;
            transition: border-color 0.3s ease;
        }

        .search-box:focus {
            outline: none;
            border-color: var(--select, #54abde);
        }

        .filter-select {
            padding: 10px 15px;
            border: 2px solid var(--box-toggle, #3a3a3a);
            border-radius: 6px;
            background: var(--box-main, #2a2a2a);
            color: var(--text, #fff);
            font-size: 14px;
            cursor: pointer;
            transition: border-color 0.3s ease;
        }

        .filter-select:focus {
            outline: none;
            border-color: var(--select, #54abde);
        }

        .history-stats {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 20px;
            margin-bottom: 30px;
        }

        .stat-card {
            padding: 20px;
            background: var(--box-main, #2a2a2a);
            border-radius: 10px;
            border: 2px solid var(--box-toggle, #3a3a3a);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            text-align: center;
            transition: all 0.3s ease;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }

        .stat-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
        }

        .stat-card h3 {
            margin: 0 0 10px 0;
            font-size: 13px;
            opacity: 0.7;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--text);
        }

        .stat-card .value {
            font-size: 24px;
            font-weight: bold;
            color: var(--text);
            word-break: break-word;
        }

        .history-list {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .history-item {
            display: flex;
            align-items: center;
            padding: 18px;
            background: var(--item-bg, #2a2a2a);
            border-radius: 10px;
            border: 2px solid var(--box-toggle, #3a3a3a);
            transition: all 0.3s ease;
            cursor: pointer;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
            gap: 15px;
        }

        .history-item:hover {
            transform: translateX(5px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            border-color: var(--select, #54abde);
        }

        .history-item-thumbnail {
            width: 80px;
            height: 80px;
            background: var(--box-toggle, #ddd);
            border-radius: 8px;
            object-fit: cover;
            flex-shrink: 0;
        }

        .history-item-info {
            flex: 1;
            min-width: 0;
            overflow: hidden;
        }

        .history-item-title {
            font-weight: 600;
            font-size: 16px;
            margin-bottom: 8px;
            overflow: hidden;
            text-overflow: ellipsis;
            color: var(--text);
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            line-height: 1.4;
            text-align: left;
        }

        .history-item-meta {
            display: flex;
            gap: 18px;
            font-size: 13px;
            opacity: 0.7;
            flex-wrap: wrap;
            color: var(--text);
            text-align: left;
        }

        .history-item-meta span {
            white-space: nowrap;
        }

        .history-item-actions {
            display: flex;
            gap: 10px;
            flex-shrink: 0;
        }

        .history-item-actions button {
            padding: 8px 16px;
            border: none;
            border-radius: 6px;
            background: var(--blueBtn, #54abde);
            color: white;
            cursor: pointer;
            font-size: 13px;
            font-weight: 600;
            transition: all 0.3s ease;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .history-item-actions button:hover {
            transform: scale(1.05);
            box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
        }

        .history-item-actions button:active {
            transform: scale(0.98);
        }

        .history-item-actions .delete-btn {
            background: var(--redBtn, #ff6b6b);
        }

        .history-item-actions .delete-btn:hover {
            background: var(--redBtn-bottom, #ff5252);
        }

        .empty-state {
            text-align: center;
            padding: 80px 20px;
            color: var(--text, #666);
        }

        .empty-state-icon {
            font-size: 64px;
            margin-bottom: 20px;
            opacity: 0.3;
        }

        .empty-state h2 {
            color: var(--text);
            margin-bottom: 10px;
        }

        .empty-state p {
            color: var(--text);
            opacity: 0.7;
        }

        .submitBtn {
            padding: 10px 24px;
            border: none;
            border-radius: 8px;
            background: var(--greenBtn, #4caf50);
            color: white;
            cursor: pointer;
            font-size: 15px;
            font-weight: 600;
            transition: all 0.3s ease;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .submitBtn:hover {
            background: var(--greenBtn-bottom, #45a049);
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        }

        .submitBtn:active {
            transform: translateY(0);
        }

        .submitBtn.close-btn {
            background: var(--redBtn, #ff6b6b);
        }

        .submitBtn.close-btn:hover {
            background: var(--redBtn-bottom, #ff5252);
        }

        .action-buttons {
            display: flex;
            gap: 12px;
            margin-bottom: 25px;
            flex-wrap: wrap;
        }

        .action-buttons button {
            padding: 12px 24px;
            border: none;
            border-radius: 8px;
            background: var(--blueBtn, #54abde);
            color: white;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 14px;
            font-weight: 600;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .action-buttons button:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        }

        .action-buttons button:active {
            transform: translateY(0);
        }

        .action-buttons .danger-btn {
            background: var(--redBtn, #ff6b6b);
        }

        .action-buttons .danger-btn:hover {
            background: var(--redBtn-bottom, #ff5252);
        }

        @media (max-width: 768px) {
            .history-stats {
                grid-template-columns: 1fr;
            }

            .history-item {
                flex-direction: column;
                align-items: flex-start;
                gap: 12px;
            }

            .history-item-thumbnail {
                margin-right: 0;
                margin-bottom: 0;
                align-self: center;
            }

            .history-item-info {
                width: 100%;
            }

            .history-item-title {
                text-align: center;
                white-space: normal;
                word-break: break-word;
            }

            .history-item-meta {
                justify-content: center;
                text-align: center;
            }

            .history-item-actions {
                margin-left: 0;
                width: 100%;
                justify-content: center;
                flex-wrap: wrap;
            }

            .history-item-actions button {
                flex: 1;
                min-width: 100px;
            }

            .search-box {
                width: 100%;
            }

            .filter-select {
                width: 100%;
            }

            .history-header h1 {
                font-size: 24px;
            }

            .action-buttons {
                width: 100%;
            }

            .action-buttons button {
                flex: 1;
                min-width: 120px;
            }
        }

        @media (max-width: 1024px) and (min-width: 769px) {
            .history-item-title {
                white-space: normal;
                word-break: break-word;
                max-width: 500px;
            }
        }

        .popup-container {
            position: fixed;
            bottom: 30px;
            left: 30px;
            z-index: 9999;

            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .popup-item {
            display: inline-block;

            color: #fff;
            padding: 12px 24px;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
            font-weight: 600;
            font-size: 15px;

            opacity: 1;
            transition: opacity 0.4s;
        }
    </style>
</head>


<body>
    <div class="history-container">
        <div class="history-header">
            <h1 id="historyTitle" data-translate="downloadHistory">Download History</h1>
            <button id="closeBtn" class="submitBtn close-btn" onclick="window.close()"
                data-translate="close">Close</button>
        </div>

        <div class="history-controls">
            <input type="text" class="search-box" id="searchBox" placeholder="Search by title or URL..."
                data-translate-placeholder="searchByTitleOrUrl">
            <select class="filter-select" id="formatFilter">
                <option value="" data-translate="allFormats">All Formats</option>
                <option value="mp4">MP4</option>
                <option value="mp3">MP3</option>
                <option value="m4a">M4A</option>
                <option value="webm">WEBM</option>
                <option value="opus">Opus</option>
                <option value="wav">WAV</option>
                <option value="flac">FLAC</option>
            </select>
        </div>

        <div class="history-stats" id="statsContainer"></div>

        <div class="action-buttons">
            <button id="exportJsonBtn" onclick="exportHistoryJSON()" data-translate="exportAsJson">Export as
                JSON</button>
            <button id="exportCsvBtn" onclick="exportHistoryCSV()" data-translate="exportAsCsv">Export as CSV</button>
            <button id="clearAllBtn" class="danger-btn" onclick="clearAllHistory()"
                data-translate="clearAllHistory">Clear All History</button>
        </div>

        <div id="historyListContainer" class="history-list"></div>
    </div>

    <div id="popupContainer" class="popup-container"></div>

    <script src="../translations/i18n-init.js"></script>

    <script>
        const { ipcRenderer } = require("electron");

        document.addEventListener('translations-loaded', () => {
            window.i18n.translatePage();
            document.title = window.i18n.__("downloadHistory")
        });

        let allHistory = [];
        let filteredHistory = [];

        // Load history on page open
        document.addEventListener("DOMContentLoaded", () => {
            loadTheme();
            loadHistory();
            setupEventListeners();
        });

        function loadTheme() {
            const storageTheme = localStorage.getItem("theme");
            if (storageTheme) {
                document.documentElement.setAttribute("theme", storageTheme);
            } else {
                document.documentElement.setAttribute("theme", "frappe");

            }
        }

        function setupEventListeners() {
            document.getElementById("searchBox").addEventListener("input", filterHistory);
            document.getElementById("formatFilter").addEventListener("change", filterHistory);
        }

        function loadHistory() {
            ipcRenderer.invoke("get-download-history").then((history) => {
                allHistory = history || [];
                renderHistory(allHistory);
                updateStats();
            }).catch((error) => {
                console.error("Failed to load history:", error);
                showPopup("Failed to load download history. Please try again.", true);
            });
        }

        function filterHistory() {
            const searchTerm = document.getElementById("searchBox").value;
            const format = document.getElementById("formatFilter").value;

            filteredHistory = allHistory.filter((item) => {
                const matchesSearch =
                    !searchTerm ||
                    item.title.toLowerCase().includes(searchTerm.toLowerCase()) ||
                    item.url.toLowerCase().includes(searchTerm.toLowerCase());

                const matchesFormat = !format || item.format.toLowerCase() === format.toLowerCase();

                return matchesSearch && matchesFormat;
            });

            renderHistory(filteredHistory);
        }

        function renderHistory(historyItems) {
            const container = document.getElementById("historyListContainer");

            // Clear container first
            container.innerHTML = '';

            if (historyItems.length === 0) {
                const emptyState = document.createElement('div');
                emptyState.className = 'empty-state';

                const icon = document.createElement('div');
                icon.className = 'empty-state-icon';
                icon.textContent = '📭';

                const heading = document.createElement('h2');
                heading.textContent = 'No Downloads Yet';

                const text = document.createElement('p');
                text.textContent = 'Your download history will appear here';

                emptyState.appendChild(icon);
                emptyState.appendChild(heading);
                emptyState.appendChild(text);
                container.appendChild(emptyState);
                return;
            }


            historyItems.forEach(item => {
                const itemDiv = document.createElement('div');
                itemDiv.className = 'history-item';
                itemDiv.dataset.id = item.id;


                const thumbnail = document.createElement(item.thumbnail ? 'img' : 'div');
                thumbnail.className = 'history-item-thumbnail';
                if (item.thumbnail) {
                    thumbnail.src = item.thumbnail;
                    thumbnail.alt = 'thumbnail';
                }
                itemDiv.appendChild(thumbnail);


                const info = document.createElement('div');
                info.className = 'history-item-info';


                const title = document.createElement('div');
                title.className = 'history-item-title';
                title.title = item.title;
                title.textContent = item.title;
                info.appendChild(title);


                const meta = document.createElement('div');
                meta.className = 'history-item-meta';


                const formatSpan = document.createElement('span');
                formatSpan.textContent = 'Format: ';
                const formatStrong = document.createElement('strong');
                formatStrong.textContent = item.format;
                formatSpan.appendChild(formatStrong);
                meta.appendChild(formatSpan);


                const sizeSpan = document.createElement('span');
                sizeSpan.textContent = 'Size: ';
                const sizeStrong = document.createElement('strong');
                sizeStrong.textContent = formatFileSize(item.fileSize);
                sizeSpan.appendChild(sizeStrong);
                meta.appendChild(sizeSpan);


                const dateSpan = document.createElement('span');
                dateSpan.textContent = 'Date: ';
                const dateStrong = document.createElement('strong');
                dateStrong.textContent = new Date(item.downloadDate).toLocaleDateString();
                dateSpan.appendChild(dateStrong);
                meta.appendChild(dateSpan);


                if (item.duration) {
                    const durationSpan = document.createElement('span');
                    durationSpan.textContent = 'Duration: ';
                    const durationStrong = document.createElement('strong');
                    durationStrong.textContent = formatDuration(item.duration);
                    durationSpan.appendChild(durationStrong);
                    meta.appendChild(durationSpan);
                }

                info.appendChild(meta);
                itemDiv.appendChild(info);


                const actions = document.createElement('div');
                actions.className = 'history-item-actions';


                const copyBtn = document.createElement('button');
                copyBtn.className = 'copy-url-btn';
                copyBtn.textContent = i18n.__('copyUrl');
                copyBtn.addEventListener('click', () => copyToClipboard(item.url));
                actions.appendChild(copyBtn);


                const openBtn = document.createElement('button');
                openBtn.className = 'open-file-btn';
                openBtn.textContent = i18n.__('open');
                openBtn.addEventListener('click', () => openFile(item.filePath));
                actions.appendChild(openBtn);


                const deleteBtn = document.createElement('button');
                deleteBtn.className = 'delete-btn';
                deleteBtn.textContent = i18n.__('delete');
                deleteBtn.addEventListener('click', () => deleteHistoryItem(item.id));
                actions.appendChild(deleteBtn);

                itemDiv.appendChild(actions);
                container.appendChild(itemDiv);
            });
        }

        function updateStats() {
            ipcRenderer.invoke("get-download-stats").then((stats) => {
                const statsContainer = document.getElementById("statsContainer");
                statsContainer.innerHTML = "";

                const createStatCard = (title, value) => {
                    const card = document.createElement("div");
                    card.className = "stat-card";

                    const titleElement = document.createElement("h3");
                    titleElement.textContent = title;

                    const valueElement = document.createElement("div");
                    valueElement.className = "value";
                    valueElement.textContent = value;

                    card.appendChild(titleElement);
                    card.appendChild(valueElement);

                    return card;
                };

                const mostCommonFormat = Object.keys(stats.byFormat).length > 0
                    ? Object.entries(stats.byFormat).sort((a, b) => b[1] - a[1])[0][0].toUpperCase()
                    : "N/A";

                statsContainer.appendChild(createStatCard(i18n.__("totalDownloads"), stats.totalDownloads));
                statsContainer.appendChild(createStatCard(i18n.__("totalSize"), formatFileSize(stats.totalSize)));
                statsContainer.appendChild(createStatCard(i18n.__("mostCommonFormat"), mostCommonFormat));

            }).catch((error) => {
                console.error("Failed to load stats:", error);
                const statsContainer = document.getElementById("statsContainer");
                // Clear any previous content
                statsContainer.innerHTML = "";

                // Helper function for creating placeholder cards
                const createPlaceholderCard = (title) => {
                    const card = document.createElement("div");
                    card.className = "stat-card";

                    const titleElement = document.createElement("h3");
                    titleElement.textContent = title;

                    const valueElement = document.createElement("div");
                    valueElement.className = "value";
                    valueElement.textContent = "--";

                    card.appendChild(titleElement);
                    card.appendChild(valueElement);

                    return card;
                };

                // Display placeholder stats on error
                statsContainer.appendChild(createPlaceholderCard("Total Downloads"));
                statsContainer.appendChild(createPlaceholderCard("Total Size"));
                statsContainer.appendChild(createPlaceholderCard("Most Common Format"));
            });
        }

        function formatFileSize(bytes) {
            if (bytes === 0) return "0 B";
            const k = 1024;
            const sizes = ["B", "KB", "MB", "GB"];
            const i = Math.floor(Math.log(bytes) / Math.log(k));
            return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + " " + sizes[i];
        }

        function formatDuration(seconds) {
            const h = Math.floor(seconds / 3600);
            const m = Math.floor((seconds % 3600) / 60);
            const s = Math.floor(seconds % 60);
            if (h > 0) return `${h}h ${m}m`;
            if (m > 0) return `${m}m ${s}s`;
            return `${s}s`;
        }

        function copyToClipboard(text) {
            const { clipboard } = require("electron");
            clipboard.writeText(text);
            showPopup(i18n.__("urlCopiedToClipboard"));
        }

        function openFile(filePath) {
            const result = ipcRenderer.invoke("show-file", filePath).then(result => {
                if (result.success === false) {
                    showPopup(i18n.__("fileDoesNotExist"), true)
                }
            })
        }

        function deleteHistoryItem(id) {
            if (confirm(i18n.__("confirmDeleteHistoryItem"))) {
                ipcRenderer.invoke("delete-history-item", id).then(() => {
                    loadHistory();
                    filterHistory();
                }).catch((error) => {
                    console.error("Failed to delete history item:", error);
                    showPopup(i18n.__("failedToDeleteHistoryItem"), true);
                });
            }
        }

        function exportHistoryJSON() {
            ipcRenderer.invoke("export-history-json").then((data) => {
                downloadFile(data, "download_history.json", "application/json");
            }).catch((error) => {
                console.error("Failed to export history as JSON:", error);
                showPopup("Failed to export history as JSON. Please try again.", true);
            });
        }

        function exportHistoryCSV() {
            ipcRenderer.invoke("export-history-csv").then((data) => {
                downloadFile(data, "download_history.csv", "text/csv");
            }).catch((error) => {
                console.error("Failed to export history as CSV:", error);
                showPopup("Failed to export history as CSV. Please try again.", true);
            });
        }

        function downloadFile(content, filename, type) {
            const element = document.createElement("a");
            element.setAttribute("href", "data:" + type + ";charset=utf-8," + encodeURIComponent(content));
            element.setAttribute("download", filename);
            element.style.display = "none";
            document.body.appendChild(element);
            element.click();
            document.body.removeChild(element);
        }

        function clearAllHistory() {
            if (
                confirm(
                    i18n.__("confirmClearAllHistory")
                )
            ) {
                ipcRenderer.invoke("clear-all-history").then(() => {
                    loadHistory();
                    filterHistory();
                }).catch((error) => {
                    console.error("Failed to clear history:", error);
                    showPopup("Failed to clear history. Please try again.", true);
                });
            }
        }

        function showPopup(text, isError = false) {
            let popupContainer = document.getElementById("popupContainer");

            if (!popupContainer) {
                popupContainer = document.createElement("div");
                popupContainer.id = "popupContainer";
                popupContainer.className = "popup-container";
                document.body.appendChild(popupContainer);
            }

            const popup = document.createElement("span");
            popup.textContent = text;
            popup.classList.add("popup-item");

            popup.style.background = isError ? "#ff6b6b" : "#54abde";

            if (isError) {
                popup.classList.add("popup-error");
            }

            popupContainer.appendChild(popup);

            setTimeout(() => {
                popup.style.opacity = "0";
                setTimeout(() => {
                    popup.remove();
                    if (popupContainer.childElementCount === 0) {
                        popupContainer.remove();
                    }
                }, 400);
            }, 2200);
        }
    </script>
</body>

</html>

================================================
FILE: html/index.html
================================================
<!DOCTYPE html>
<html lang="en">

<head>
    <header></header>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>YtDownloader</title>
    <link rel="stylesheet" href="../assets/css/index.css">

    <script src="../translations/i18n-init.js" defer></script>
    <script src="../src/renderer.js" defer></script>
    <script src="../src/index.js" defer></script>
    <script src="../src/common.js" defer></script>
</head>

<body>
    <div id="popupBox">
        <div id="popup">
            <p data-translate="downloadingNecessaryFilesWait">Please wait, necessary files are being downloaded</p>
            <svg id="popupSvg" version="1.1" id="L4" xmlns="http://www.w3.org/2000/svg"
                xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100"
                enable-background="new 0 0 0 0" xml:space="preserve">
                <circle fill="rgb(84, 171, 222)" stroke="none" cx="6" cy="50" r="6">
                    <animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.1" />
                </circle>
                <circle fill="rgb(84, 171, 222)" stroke="none" cx="26" cy="50" r="6">
                    <animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.2" />
                </circle>
                <circle fill="rgb(84, 171, 222)" stroke="none" cx="46" cy="50" r="6">
                    <animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.3" />
                </circle>
            </svg>
            <p id="ytDlpDownloadProgress"></p>
        </div>
    </div>

    <div id="popupBoxMac">
        <div id="popupMac">
            <p id="popupMacTxt" data-translate="homebrewYtDlpWarning">You need to download yt-dlp from homebrew first
            </p>
            <div style="display: flex;">
                <a class="blueBtn" id="openHomebrew" target="_blank" href="https://formulae.brew.sh/formula/yt-dlp"
                    data-translate="openHomebrew">Open Homebrew</a>
                <button class="advancedToggle" id="quitAppBtn" data-translate="close">Close</button>
            </div>
        </div>
    </div>

    <!-- Menu icon -->
    <img src="../assets/images/menu.png" alt="menu" id="menuIcon">

    <!-- Menu -->
    <div id="menu" class="menu">
        <a id="playlistWin" class="menuItem" data-translate="downloadPlaylistButton">Download Playlist</a>
        <a id="preferenceWin" class="menuItem" data-translate="preferences">Preferences</a>
        <a id="compressorWin" class="menuItem" data-translate="compressor">Compressor</a>
        <a id="historyWin" class="menuItem" data-translate="downloadHistory">History</a>
        <a id="aboutWin" class="menuItem" data-translate="about">About</a>

        <div class="menuDivider"></div>

        <label for="themeToggle" id="themeTxt" class="menuLabel" data-translate="theme">Theme</label>
        <select name="themeToggle" id="themeToggle" class="themeSelect">
            <option id="lightTxt" value="light" data-translate="themeLight">Light</option>
            <option id="darkTxt" value="dark" data-translate="themeDark">Dark</option>
            <option id="frappeTxt" value="frappe" data-translate="themeFrappe">Frappé</option>
            <option id="onedarkTxt" value="onedark" data-translate="themeOneDark">One dark</option>
            <option id="matrixTxt" value="matrix" data-translate="themeMatrix">Matrix</option>
            <option id="githubTxt" value="github">Github</option>
            <option id="latteTxt" value="latte">Latte</option>
            <option id="solarizedDarkTxt" value="solarized-dark" data-translate="themeSolarizedDark">Solarized Dark</option>
            <option id ="guvboxTxt" value="gruvbox" data-translate="themeGruvbox">gruvbox</option>
        </select>
    </div>


    <button id="pasteUrl">
        <span id="pasteText" data-translate="pasteText">Click to paste video link from clipboard</span>
        <span class="paste-keys">
            <span class="key" id="pasteCtrlKey">Ctrl</span><span class="key">V</span>
        </span>
    </button>


    <div id="loadingWrapper">
        <span id="processing" data-translate="processing">Loading </span>
        <svg version="1.1" id="L4" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
            y="0px" viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve">
            <circle fill="rgb(84, 171, 222)" stroke="none" cx="6" cy="50" r="6">
                <animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.1" />
            </circle>
            <circle fill="rgb(84, 171, 222)" stroke="none" cx="26" cy="50" r="6">
                <animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.2" />
            </circle>
            <circle fill="rgb(84, 171, 222)" stroke="none" cx="46" cy="50" r="6">
                <animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.3" />
            </circle>
        </svg>
    </div>
    <p id="incorrectMsg"></p>
    <button class="advancedToggle" id="errorBtn" onclick="toggleErrorDetails()" data-translate="errorDetails">Error
        Details ▼</button>
    <div id="errorDetails"></div>
    <br>

    <div id="hidden">
        <img src="../assets/images/close.png" alt="close" id="closeHidden">
        <div id="btnContainer">
            <button class="toggleBtn" id="videoToggle" data-translate="video">Video</button>
            <button class="toggleBtn" id="audioToggle" data-translate="audio">Audio</button>
        </div>
        <p id="title" data-translate="title">Title </p>

        <div class="videoAudioContainer">
            <!-- Video tab -->
            <div id="videoList">
                <div class="separationBox">
                    <h2 id="videoHeader" data-translate="video">Video</h2>
                    <label class="formatSelect" data-translate="selectFormat">Select Format </label>
                    <select id="videoFormatSelect" class="select">
                    </select>
                    <br>
                    <input type="hidden" name="url" class="url" id="url">

                    <!-- Audio options for video -->
                    <div id="audioForVideo">
                        <h2 id="audioHeader" data-translate="audio">Audio</h2>
                        <label class="formatSelect" data-translate="selectAudioFormat">Select Audio Format </label>
                        <select id="audioForVideoFormatSelect" class="select">
                        </select>
                        <br>
                        <input type="hidden" name="url" class="url">
                    </div>
                    <br>
                </div>

                <br>
                <button class="submitBtn" id="videoDownload" data-translate="download">Download</button>
                <button id="advancedVideoToggle" class="blueBtn" onClick="advancedToggle()"
                    data-translate="moreOptions">More options</button>
            </div>

            <!-- Audio tab -->
            <div id="audioList">
                <div id="audioPresent">
                    <label class="formatSelect" data-translate="selectFormat">Select Format </label>
                    <select id="audioFormatSelect" class="select">
                    </select>
                    <br>
                    <input type="hidden" name="url" class="url">
                    <button class="submitBtn" id="audioDownload" data-translate="download">Download</button>
                    <button id="advancedAudioToggle" class="blueBtn" onClick="advancedToggle()"
                        data-translate="moreOptions">More options</button>
                </div>
            </div>
        </div>

        <div id="advanced">
            <div class="advancedItem">
                <p id="customArgsHeader" data-translate="customArgsTxt">Custom yt-dlp arguments</p>
                <textarea id="customArgsInput" placeholder="--sponsorblock-remove all"></textarea>
            </div>
            <div class="advancedItem">
                <span id="quitTxt" data-translate="closeAppOnFinish">Close app when download finishes</span>
                <input type="checkbox" id="quitChecked" class="cb">
            </div>

            <div class="advancedItem">
                <strong id="rangeText" data-translate="downloadTimeRange">Download particular time-range</strong>
                <br><br>
                <div class="slider-wrapper">
                    <input type="text" id="min-time" class="time-display" value="0:00:00">
                    <div class="slider-container">
                        <div class="track-background"></div>
                        <div id="range-highlight"></div>
                        <input type="range" id="min-slider" min="0" max="0" value="0">
                        <input type="range" id="max-slider" min="0" max="0" value="0">
                    </div>
                    <input type="text" id="max-time" class="time-display" value="0:00:00">
                </div>
            </div>

            <div class="advancedItem">
                <div><span id="clText" data-translate="currentDownloadLocation">Current download location - </span><span
                        id="path"></span></div>
                <br>
                <button id="selectLocation" class="submitBtn" data-translate="selectDownloadLocation">Select Download
                    Location</button>
            </div>

            <div class="advancedItem">
                <p id="subHeader" data-translate="subtitles">Subtitles</p>
                <span id="subTxt" data-translate="downloadSubtitlesAvailable">Download subtitles if available</span>
                <input id="subChecked" class="cb" type="checkbox">
            </div>
        </div>

        <!-- Extraction options start -->
        <div id="audioExtract">
            <h2 id="extractHeader" data-translate="extractAudio">Extract Audio</h2>
            <div>
                <div>
                    <label class="formatSelect" data-translate="selectFormat">Select Format </label>
                    <select id="extractSelection" class="select audioSelect">
                        <option value="mp3">Mp3</option>
                        <option value="m4a">M4a</option>
                        <option value="opus">Opus</option>
                        <option value="wav">Wav</option>
                        <option value="alac">Alac</option>
                        <option value="flac">Flac</option>
                    </select>
                </div>

                <div>
                    <label class="extractQualitySelect" id="extractQualitySelectTxt"
                        data-translate="selectQuality">Select
                        Quality</label>
                    <select id="extractQualitySelect" class="select audioSelect">
                        <option id="extractQualityNormal" value="5" data-translate="qualityNormal">Normal</option>
                        <option id="extractQualityBest" value="0" data-translate="best">Best</option>
                        <option id="extractQualityGood" value="2" data-translate="qualityGood">Good</option>
                        <option id="extractQualityBad" value="8" data-translate="qualityBad">Bad</option>
                        <option id="extractQualityWorst" value="10" data-translate="qualityWorst">Worst</option>
                    </select>
                </div>
            </div>

            <br>
            <button id="extractBtn" data-translate="extract">Extract</button>
        </div>
        <!-- Extraction options end -->
    </div>

    <!-- Downloads list -->
    <div id="list"></div>

    <button class="blueBtn" id="clearBtn" data-translate="clearDownloads">Clear Downloads</button>

    <div id="goToTop"></div>

    <script>
        const os = require("os")

        if (os.platform() === "darwin") {
            document.getElementById("pasteCtrlKey").textContent = "⌘";
        }
    </script>

    <div id="popupContainer" class="popup-container"></div>

    <div id="updatePopup">
        <span class="update-label" data-translate="downloadingUpdate">Downloading update</span>

        <div class="progress-track">
            <div id="progressBarFill"></div>
        </div>

        <span id="updateProgress">0.0%</span>
    </div>
</body>

</html>

================================================
FILE: html/playlist.html
================================================
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title data-translate="downloadPlaylistButton">Playlist download</title>
    <link rel="stylesheet" href="../assets/css/index.css">

    <script src="../translations/i18n-init.js" defer></script>
    <script src="../src/playlist.js" defer></script>
    <script src="../src/common.js" defer></script>

    <style>
        #playlistName {
            padding: 30px;
        }

        #pasteLink {
            margin-top: 15px;
            font-weight: bold;
        }

        #openDownloads {
            display: none;
            position: relative;
            bottom: 8px;
        }

        #audioBox {
            display: none;
        }

        #advancedMenu {
            display: none;
        }
    </style>
</head>

<body>
    <!-- Menu icon -->
    <img src="../assets/images/menu.png" alt="menu" id="menuIcon">

    <!-- Menu -->
    <div id="menu" class="menu">
        <a id="homeWin" class="menuItem" data-translate="homepage">Homepage</a>
        <a id="preferenceWin" class="menuItem" data-translate="preferences">Preferences</a>
        <a id="compressorWin" class="menuItem" data-translate="compressor">Compressor</a>
        <a id="historyWin" class="menuItem" data-translate="downloadHistory">History</a>
        <a id="aboutWin" class="menuItem" data-translate="about">About</a>

        <div class="menuDivider"></div>

        <label for="themeToggle" id="themeTxt" class="menuLabel" data-translate="theme">Theme</label>
        <select name="themeToggle" id="themeToggle" class="themeSelect">
            <option id="lightTxt" value="light" data-translate="themeLight">Light</option>
            <option id="darkTxt" value="dark" data-translate="themeDark">Dark</option>
            <option id="frappeTxt" value="frappe" data-translate="themeFrappe">Frappé</option>
            <option id="onedarkTxt" value="onedark" data-translate="themeOneDark">One dark</option>
            <option id="matrixTxt" value="matrix" data-translate="themeMatrix">Matrix</option>
            <option id="githubTxt" value="github">Github</option>
            <option id="latteTxt" value="latte">Latte</option>
            <option id="solarizedDarkTxt" value="solarized-dark" data-translate="themeSolarizedDark">Solarized Dark
            </option>
        </select>
    </div>

    <button id="pasteLink">
        <span id="pasteText" data-translate="pastePlaylistLinkTooltip">Click to paste playlist link from
            clipboard</span>
        <span class="paste-keys">
            <span class="key" id="pasteCtrlKey">Ctrl</span><span class="key">V</span>
        </span>
    </button>

    <div id="options">
        <img src="../assets/images/close.png" alt="close" id="closeHidden">
        <div id="btnContainer">
            <button class="toggleBtn" id="videoToggle" data-translate="video">Video</button>
            <button class="toggleBtn" id="audioToggle" data-translate="audio">Audio</button>
        </div>
        <br>
        <strong id="linkTitle" data-translate="link">Link:</strong>
        <span id="link"></span>
        <br><br>
        <div id="videoBox">
            <label id="videoFormat" data-translate="videoQuality">Select Video Quality </label>
            <select id="select" class="select">
                <option value="best" id="bestVideoOption" data-translate="best">Best</option>
                <option value="worst" id="worstVideoOption" data-translate="qualityWorst">Worst</option>
                <option value="useConfig" id="useConfigTxt" data-translate="useConfigFileCheckbox">Use config file
                </option>
                <option value="144">144p</option>
                <option value="240">240p</option>
                <option value="360">360p</option>
                <option value="480">480p</option>
                <option value="720">720p (HD)</option>
                <option value="1080">1080p (FHD)</option>
                <option value="1440">1440p</option>
                <option value="2160">2160p (4k)</option>
            </select>
            <br>
            <div id="typeSelectBox">
                <label id="videoQualityTxt" data-translate="selectVideoFormat">Select video quality</label>
                <select id="videoTypeSelect" class="select">
                    <option value="auto" id="autoTxt" data-translate="auto">Auto</option>
                    <option value="mp4">Mp4</option>
                    <option value="webm">WebM</option>
                </select>
            </div>
            <br>
            <button class="submitBtn" id="download" data-translate="download">Download</button>
            <br><br>
        </div>

        <div id="audioBox">

            <label id="audioFormat" data-translate="selectAudioFormat">Select Audio format </label>
            <select id="audioSelect" class="select">
                <option value="mp3">Mp3</option>
                <option value="m4a">M4a</option>
                <option value="opus">Opus</option>
                <option value="wav">Wav</option>
                <option value="alac">Alac</option>
                <option value="flac">Flac</option>
            </select>
            <br>

            <label class="audioQualitySelect" id="audioQualitySelectTxt" data-translate="selectQuality">Select
                Quality</label>
            <select id="audioQualitySelect" class="select">
                <option id="audioQualityAuto" value="auto" data-translate="auto">Auto</option>
                <option id="audioQualityNormal" value="5" data-translate="qualityNormal">Normal</option>
                <option id="audioQualityBest" value="0" data-translate="best">Best</option>
                <option id="audioQualityGood" value="2" data-translate="qualityGood">Good</option>
                <option id="audioQualityBad" value="8" data-translate="qualityBad">Bad</option>
                <option id="audioQualityWorst" value="10" data-translate="qualityWorst">Worst</option>
            </select>
            <br><br>

            <button class="submitBtn" id="audioDownload" data-translate="download">Download</button>
            <br><br>

        </div>

        <br>
        <button id="advancedToggle" class="blueBtn" data-translate="moreOptions">More options</button>
        <br>

        <!-- Hidden -->
        <div id="advancedMenu">
            <div class="advancedItem">
                <span id="rangeTxt" data-translate="playlistRange">Playlist range</span>
                <input type="number" id="playlistIndex" class="input" data-translate-placeholder="start" placeholder="Start">:
                <input type="number" id="playlistEnd" data-translate-placeholder="end" class="input" placeholder="End">
                <br><br>
            </div>

            <div class="advancedItem">
                <div><span id="clText" data-translate="currentDownloadLocation">Current download location - </span><span
                        id="path"></span></div>
                <br>
                <button id="selectLocation" class="submitBtn" data-translate="selectDownloadLocation">Select Download
                    Location</button>
            </div>

            <div class="advancedItem">
                <p id="subHeader" data-translate="subtitles">Subtitles</p>
                <span id="subTxt" data-translate="downloadSubtitlesAvailable">Download subtitles if available</span>
                <input id="subChecked" class="cb" type="checkbox">
            </div>
            <br>

            <button class="submitBtn" id="downloadThumbnails" data-translate="downloadThumbnails">Download
                thumbnails</button>
            <button class="submitBtn" id="saveLinks" data-translate="saveVideoLinksToFile">Save video links</button>
        </div>

        <p id="incorrectMsgPlaylist"></p>
        <!-- Error button -->
        <button class="advancedToggle" id="errorBtn" onclick="toggleErrorDetails()" data-translate="errorDetails">Error
            Details ▼</button>
        <div id="errorDetails"></div>

    </div>

    <h2 id="playlistName"></h2>
    <button class="submitBtn" id="openDownloads" data-translate="openDownloadFolder">Open download folder</button>
    <div id="list">
    </div>

    <div id="goToTop"></div>
</body>

</html>

================================================
FILE: html/playlist_new.html
================================================
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Playlist download</title>
    <link rel="stylesheet" href="../assets/css/index.css">
    <script src="../src/playlist_new.js" defer></script>
    <script src="../src/common.js" defer></script>
    <!-- Translating -->
    <script>window.i18n = new (require('../translations/i18n'));</script>
    <style>
        .playlistCheck {
            position: absolute;
            bottom: 8px;
            right: 8px;
            width: 25px;
            height: 25px;
        }
    </style>
</head>

<body>
    <!-- Popup message -->
    <span id="popupText">Text copied</span>

    <!-- Menu icon -->
    <img src="../assets/images/menu.png" alt="menu" id="menuIcon">

    <!-- Menu -->
    <div id="menu">
        <a id="homeWin" class="menuItem">Homepage</a>
        <a id="preferenceWin" class="menuItem">Preferences</a>
        <a id="historyWin" class="menuItem">History</a>
        <a id="aboutWin" class="menuItem">About</a>
        <span id="themeTxt" class="menuItem">Theme:</span>
        <select name="themeToggle" id="themeToggle">
            <option id="lightTxt" value="light">Light</option>
            <option id="darkTxt" value="dark">Dark</option>
            <option id="frappeTxt" value="frappe">Frappé</option>
            <option id="onedarkTxt" value="onedark">One dark</option>
            <option id="matrixTxt" value="matrix">Matrix</option>
            <option id="githubTxt" value="github">Github</option>
            <option id="latteTxt" value="latte">Latte</option>
            <option id="solarizedDarkTxt" value="solarized-dark">Solarized Dark</option>
            <option id="gruvboxTxt" value="gruvbox">Gruvbox</option>
        </select>
    </div>

    <button class="submitBtn" id="pasteLink">Click to paste playlist link from clipboard [Ctrl + V]</button>

    <div id="loadingWrapper">
        <span id="processing">Loading </span>
        <svg version="1.1" id="L4" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
            y="0px" viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve">
            <circle fill="rgb(84, 171, 222)" stroke="none" cx="6" cy="50" r="6">
                <animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.1" />
            </circle>
            <circle fill="rgb(84, 171, 222)" stroke="none" cx="26" cy="50" r="6">
                <animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.2" />
            </circle>
            <circle fill="rgb(84, 171, 222)" stroke="none" cx="46" cy="50" r="6">
                <animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.3" />
            </circle>
        </svg>
    </div>

    <p id="incorrectMsg"></p>
    <button class="advancedToggle" id="errorBtn" onclick="toggleErrorDetails()">Error Details ▼</button>
    <div id="errorDetails" onclick="copyErrorToClipboard()"></div>
    <div id="data">
    </div>
    <div id="goToTop"></div>
</body>

</html>

================================================
FILE: html/preferences.html
================================================
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title id="title" data-translate="preferences">Preferences</title>
    <link rel="stylesheet" href="../assets/css/extra.css">

    <script src="../translations/i18n-init.js" defer></script>
    <script src="../src/preferences.js" defer></script>
</head>

<body>
    <div id="top">
        <a id="restart" data-translate="restartApp">Restart app</a>
        <a id="back" data-translate="homepage">Homepage</a>
    </div>

    <h1 id="preferences" data-translate="preferences">Preferences</h1>
    <br><br>

    <div class="prefBox" style="border: none;">
        <strong id="dlText" data-translate="downloadLocation">Download location</strong>
    </div>

    <div class="prefBox">
        <span id="clText" data-translate="currentDownloadLocation">Current download location - </span><span
            id="path"></span>
    </div>

    <button id="selectLocation" class="greenBtn" data-translate="selectDownloadLocation">Select Download
        Location</button>

    <p id="msg">
    </p>

    <!-- Language -->
    <div class="prefBox">
        <label id="selectLn" data-translate="selectLanguageRelaunch">Select Language (Requires reload)</label>
        <select id="select" onchange="changeLanguage()">
            <option value="en">English</option>
            <option value="de-DE">Deutsch</option>
            <option value="es-ES">Español</option>
            <option value="fa-IR">فارسی</option>
            <option value="el-GR">Ελληνικά</option>
            <option value="fr-FR">Français</option>
            <option value="it-IT">Italiano</option>
            <option value="ja-JP">Japanese</option>
            <option value="hu-HU">Magyar</option>
            <option value="pl-PL">Polski</option>
            <option value="pt-BR">Português</option>
            <option value="ru-RU">Русский</option>
            <option value="fi-FI">Finnish</option>
            <option value="uk-UA">Українська</option>
            <option value="tr-TR">Türkçe</option>
            <option value="vi-VN">Vietnamese</option>
            <option value="ar-SA">اَلْعَرَبِيَّةُ</option>
            <option value="zh-CN">简体中文</option>
            <option value="zh-TW">繁體中文</option>
            <option value="bn-BD">বাংলা</option>
            <option value="hi-IN">हिन्दी</option>
            <option value="ne-NP">नेपाली</option>
        </select>
    </div>

    <!-- Video Quality -->
    <div class="prefBox">
        <span id="preferredVideoTxt" data-translate="preferredVideoQuality">Preferred video quality</span>
        <select id="preferredVideoQuality">
            <option value="144">144p</option>
            <option value="240">240p</option>
            <option value="360">360p</option>
            <option value="480">480p</option>
            <option value="720">720p (HD)</option>
            <option value="1080">1080p (FHD)</option>
            <option value="1440">1440p</option>
            <option value="2160">2160p (4k)</option>
        </select>

    </div>

    <!-- Video Codec -->
    <div class="prefBox">
        <span id="preferredVideoCodecTxt" data-translate="preferredVideoCodec">Preferred video codec</span>
        <select id="preferredVideoCodec">
            <option value="avc1">AVC1</option>
            <option value="av01">AV1</option>
            <option value="vp9">VP9</option>
            <option value="mp4v">MP4V</option>
        </select>

    </div>

    <!-- Audio format -->
    <div class="prefBox">
        <span id="preferredAudioTxt" data-translate="preferredAudioFormat">Preferred audio format</span>
        <select id="preferredAudioQuality">
            <option value="mp3">Mp3</option>
            <option value="aac">Aac</option>
            <option value="m4a">M4a</option>
            <option value="opus">Opus</option>
            <option value="wav">Wav</option>
            <option value="alac">Alac</option>
            <option value="flac">Flac</option>
        </select>

    </div>

    <p id="flatpakTxt" data-translate="flatsealPermissionWarning"></p>
    <div class="prefBox">
        <div>
            <span id="browserTxt" data-translate="selectBrowserForCookies">Select browser to use cookies from</span>
            <span id="browserInfo" data-translate-title="cookiesWarning"> &#9432;</span>
        </div>
        <select id="browser">
            <option value="" id="none" data-translate="none">None</option>
            <option value="chrome">Chrome</option>
            <option value="firefox">Firefox</option>
            <option value="brave">Brave</option>
            <option value="opera">Opera Mini</option>
            <option value="edge">Edge</option>
            <option value="chromium">Chromium</option>
            <option value="safari">Safari</option>
            <option value="vivaldi">Vivaldi</option>
        </select>
    </div>

    <div class="prefBox">
        <span id="proxyTitle" data-translate="proxy">Proxy</span>
        <input type="text" id="proxyTxt" placeholder="http://localhost:8080"
            pattern="^(http:\/\/|https:\/\/|socks5:\/\/)?[a-zA-Z0-9.]+:[\d]+$">
    </div>

    <div id="ytDlpArgBox">
        <p>
            <span data-translate="customArgsTxt">Set custom yt-dlp arguments.</span>
            <a data-translate="learnMore" id="learnMoreLink">Learn more</a>
        </p>
        <textarea spellcheck="false" id="customArgsInput" placeholder="--sponsorblock-remove all"></textarea>
    </div>

    <div id="pathConfig">

        <div class="configBox">
            <span id="configTxt" data-translate="useConfigFile">Use configuration file</span>
            <input type="checkbox" class="cb" id="configCheck">
        </div>

        <div id="configOpts">
            <br>
            <button class="greenBtn" id="configBtn" data-translate="selectConfigFile">Select config file</button>
            <br>
            <strong id="configPathTxt" data-translate="path">Path:</strong>
            <span id="configPath"></span>
        </div>
    </div>

    <div class="prefBox">
        <span id="showMoreFormatsTxt" data-translate="showMoreFormatOptions">Show more format options</span>
        <input type="checkbox" class="cb" id="showMoreFormats">
    </div>

    <div class="prefBox">
        <span id="fileFormatTxt" data-translate="playlistFilenameFormat">Filename format for playlists</span>
        <input type="text" id="filenameFormat" placeholder="yt-dlp format style"
            value="%(playlist_index)s.%(title)s.%(ext)s">
        <button class="redBtn" id="resetFilenameFormat" data-translate="resetToDefault">Reset to default</button>
    </div>

    <div class="prefBox">
        <span id="dirFormatTxt" data-translate="playlistFolderNameFormat">Folder name format for playlists</span>
        <input type="text" id="foldernameFormat" value="%(playlist_title)s" placeholder="yt-dlp format style">
        <button class="redBtn" id="resetFoldernameFormat" data-translate="resetToDefault">Reset to default</button>
    </div>


    <div class="prefBox">
        <span id="maxTxt" data-translate="maxActiveDownloads">Maximum number of active downloads</span>
        <input type="number" min="1" class="input" id="maxDownloads" value="5">
    </div>


    <div class="prefBox">
        <span id="trayTxt" data-translate="closeAppToTray">Close to system tray</span>
        <input type="checkbox" class="cb" id="closeToTray">
    </div>

    <div class="prefBox" id="autoUpdatesBox">
        <span id="autoUpdateTxt" data-translate="disableAutoUpdates">Disable auto updates</span>
        <input type="checkbox" class="cb" id="autoUpdateDisabled">
    </div>
</body>

</html>

================================================
FILE: linux.sh
================================================
#!/bin/bash

# >> Check if curl is installed or nor
if ! command -V curl > /dev/null 2>&1; then
    echo "curl not installed, please install it and try again"
    exit
fi

wget "https://github.com/aandrew-me/ffmpeg-builds/releases/download/v8/ffmpeg_linux_amd64.tar.xz"
wget "https://github.com/aandrew-me/ffmpeg-builds/releases/download/v8/node_linux_amd64" -O node
chmod +x node
tar -xf ffmpeg_linux_amd64.tar.xz
mv ffmpeg_linux_amd64 ffmpeg
chmod +x ffmpeg/bin/ffmpeg
chmod +x ffmpeg/bin/ffprobe
chmod +x ffmpeg/bin/ffplay



================================================
FILE: mac.sh
================================================
#!/bin/bash
# >> Check if curl is installed or nor
if ! command -v curl > /dev/null 2>&1; then
    echo "curl not installed, please install it and try again"
    exit 1
fi

ARCH=$(uname -m)
mkdir -p ffmpeg/bin

if [ "$ARCH" = "arm64" ]; then
    FF_URL="https://github.com/aandrew-me/ffmpeg-builds/releases/download/v8/ffmpeg_macos_arm64"
    FP_URL="https://github.com/aandrew-me/ffmpeg-builds/releases/download/v8/ffprobe_macos_arm64"
elif [ "$ARCH" = "x86_64" ]; then
    FF_URL="https://github.com/aandrew-me/ffmpeg-builds/releases/download/v8/ffmpeg_macos_amd64"
    FP_URL="https://github.com/aandrew-me/ffmpeg-builds/releases/download/v8/ffprobe_macos_amd64"
else
    echo "Unsupported architecture: $ARCH"
    exit 1
fi

curl -L "$FF_URL" -o ffmpeg/bin/ffmpeg
curl -L "$FP_URL" -o ffmpeg/bin/ffprobe
chmod +x ffmpeg/bin/ffmpeg
chmod +x ffmpeg/bin/ffprobe


================================================
FILE: main.js
================================================
const {
	app,
	BrowserWindow,
	dialog,
	ipcMain,
	shell,
	Tray,
	Menu,
	clipboard,
} = require("electron");
const {autoUpdater} = require("electron-updater");
const fs = require("fs").promises;
const {existsSync, readFileSync} = require("fs");
const path = require("path");
const DownloadHistory = require("./src/history");

process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "true";
autoUpdater.autoDownload = false;

const USER_DATA_PATH = app.getPath("userData");
const CONFIG_FILE_PATH = path.join(USER_DATA_PATH, "ytdownloader.json");

const appState = {
	/** @type {BrowserWindow | null} */
	mainWindow: null,
	/** @type {BrowserWindow | null} */
	secondaryWindow: null,
	/** @type {Tray | null} */
	tray: null,
	isQuitting: false,
	indexPageIsOpen: true,
	trayEnabled: false,
	loadedLanguage: {},
	config: {},
	downloadHistory: new DownloadHistory(),
	autoUpdateEnabled: false,
};

const gotTheLock = app.requestSingleInstanceLock();

if (!gotTheLock) {
	app.quit();
} else {
	app.on("second-instance", () => {
		if (appState.mainWindow) {
			if (appState.mainWindow.isMinimized())
				appState.mainWindow.restore();
			appState.mainWindow.show();
			appState.mainWindow.focus();
		}
	});
}

app.whenReady().then(async () => {
	await initialize();

	app.on("activate", () => {
		if (BrowserWindow.getAllWindows().length === 0) {
			createWindow();
		}
	});
});

app.on("before-quit", async () => {
	appState.isQuitting = true;
	try {
		// Save the final config state before exiting.
		await saveConfiguration();
	} catch (error) {
		console.error("Failed to save configuration during quit:", error);
	}
});

app.on("window-all-closed", () => {
	if (process.platform !== "darwin") {
		app.quit();
	}
});

/**
 * Initializes the application by loading config, translations,
 * and setting up handlers.
 */
async function initialize() {
	await loadConfiguration();
	await loadTranslations();

	registerIpcHandlers();
	registerAutoUpdaterEvents();

	createWindow();

	if (process.platform === "win32") {
		app.setAppUserModelId(app.name);
	}
}

function createWindow() {
	const bounds = appState.config.bounds || {};

	appState.mainWindow = new BrowserWindow({
		...bounds,
		minWidth: 800,
		minHeight: 600,
		autoHideMenuBar: true,
		show: false,
		icon: path.join(__dirname, "/assets/images/icon.png"),
		webPreferences: {
			nodeIntegration: true,
			contextIsolation: false,
			spellcheck: false,
		},
	});

	appState.mainWindow.loadFile("html/index.html");

	appState.mainWindow.once("ready-to-show", () => {
		if (appState.config.isMaximized) {
			appState.mainWindow.maximize();
		}
		appState.mainWindow.show();
	});

	const saveBounds = () => {
		if (appState.mainWindow && !appState.mainWindow.isMaximized()) {
			appState.config.bounds = appState.mainWindow.getBounds();
		}
	};

	appState.mainWindow.on("resize", saveBounds);
	appState.mainWindow.on("move", saveBounds);

	appState.mainWindow.on("maximize", () => {
		appState.config.isMaximized = true;
	});

	appState.mainWindow.on("unmaximize", () => {
		appState.config.isMaximized = false;
	});

	appState.mainWindow.on("close", (event) => {
		if (!appState.isQuitting && appState.trayEnabled) {
			event.preventDefault();
			appState.mainWindow.hide();
			if (app.dock) app.dock.hide();
		}
	});
}

/**
 * @param {string} file The HTML file to load.
 */
function createSecondaryWindow(file) {
	if (appState.secondaryWindow) {
		appState.secondaryWindow.focus();
		return;
	}

	appState.secondaryWindow = new BrowserWindow({
		parent: appState.mainWindow,
		modal: true,
		show: false,
		webPreferences: {
			nodeIntegration: true,
			contextIsolation: false,
		},
		width: 1000,
		height: 800,
	});

	// appState.secondaryWindow.webContents.openDevTools();
	appState.secondaryWindow.loadFile(file);
	appState.secondaryWindow.setMenu(null);
	appState.secondaryWindow.once("ready-to-show", () => {
		appState.secondaryWindow.show();
	});

	appState.secondaryWindow.on("closed", () => {
		appState.secondaryWindow = null;
	});
}

/**
 * Creates the system tray icon
 */
function createTray() {
	if (appState.tray) return;

	let iconPath;
	if (process.platform === "win32") {
		iconPath = path.join(__dirname, "resources/icon.ico");
	} else if (process.platform === "darwin") {
		iconPath = path.join(__dirname, "resources/icons/16x16.png");
	} else {
		iconPath = path.join(__dirname, "resources/icons/256x256.png");
	}

	appState.tray = new Tray(iconPath);

	const contextMenu = Menu.buildFromTemplate([
		{
			label: i18n("openApp"),
			click: () => {
				appState.mainWindow?.show();
				if (app.dock) app.dock.show();
			},
		},
		{
			label: i18n("pasteVideoLink"),
			click: async () => {
				const text = clipboard.readText();
				appState.mainWindow?.show();
				if (app.dock) app.dock.show();
				if (appState.indexPageIsOpen) {
					appState.mainWindow.webContents.send("link", text);
				} else {
					await appState.mainWindow.loadFile("html/index.html");
					appState.indexPageIsOpen = true;
					appState.mainWindow.webContents.once(
						"did-finish-load",
						() => {
							appState.mainWindow.webContents.send("link", text);
						}
					);
				}
			},
		},
		{
			label: i18n("downloadPlaylistButton"),
			click: () => {
				appState.indexPageIsOpen = false;
				appState.mainWindow?.loadFile("html/playlist.html");
				appState.mainWindow?.show();
				if (app.dock) app.dock.show();
			},
		},
		{
			label: i18n("quit"),
			click: () => {
				app.quit();
			},
		},
	]);

	appState.tray.setToolTip("ytDownloader");
	appState.tray.setContextMenu(contextMenu);
	appState.tray.on("click", () => {
		appState.mainWindow?.show();

		if (app.dock) app.dock.show();
	});
}

function registerIpcHandlers() {
	ipcMain.on("autoUpdate", (_event, status) => {
		appState.autoUpdateEnabled = status;

		if (status) {
			autoUpdater.checkForUpdates();
		}
	});

	ipcMain.on("reload", () => {
		appState.mainWindow?.reload();
		appState.secondaryWindow?.reload();
	});

	ipcMain.on("get-version", (event) => {
		event.sender.send("version", app.getVersion());
	});

	ipcMain.on("show-file", async (_event, fullPath) => {
		try {
			await fs.stat(fullPath);
			shell.showItemInFolder(fullPath);
		} catch (error) {}
	});

	ipcMain.handle("show-file", async (_event, fullPath) => {
		try {
			await fs.stat(fullPath);
			shell.showItemInFolder(fullPath);

			return {success: true};
		} catch (error) {
			return {success: false, error: error.message};
		}
	});

	ipcMain.handle("open-folder", async (_event, folderPath) => {
		try {
			await fs.stat(folderPath);
			const result = await shell.openPath(folderPath);
			if (result) {
				return {success: false, error: result};
			} else {
				return {success: true};
			}
		} catch (error) {
			return {success: false, error: error.message};
		}
	});

	ipcMain.on("load-win", (_event, file) => {
		appState.indexPageIsOpen = file.includes("index.html");
		appState.mainWindow?.loadFile(file);
	});

	ipcMain.on("load-page", (_event, file) => {
		createSecondaryWindow(file);
	});

	ipcMain.on("close-secondary", () => {
		appState.secondaryWindow?.close();
	});

	ipcMain.on("quit", () => {
		app.quit();
	});

	ipcMain.on("select-location-main", async () => {
		if (!appState.mainWindow) return;
		const {canceled, filePaths} = await dialog.showOpenDialog(
			appState.mainWindow,
			{properties: ["openDirectory"]}
		);
		if (!canceled && filePaths.length > 0) {
			appState.mainWindow.webContents.send("downloadPath", filePaths);
		}
	});

	ipcMain.on("select-location-secondary", async () => {
		if (!appState.secondaryWindow) return;
		const {canceled, filePaths} = await dialog.showOpenDialog(
			appState.secondaryWindow,
			{properties: ["openDirectory"]}
		);
		if (!canceled && filePaths.length > 0) {
			appState.secondaryWindow.webContents.send(
				"downloadPath",
				filePaths
			);
		}
	});

	ipcMain.on("get-directory", async () => {
		if (!appState.mainWindow) return;
		const {canceled, filePaths} = await dialog.showOpenDialog(
			appState.mainWindow,
			{properties: ["openDirectory"]}
		);
		if (!canceled && filePaths.length > 0) {
			appState.mainWindow.webContents.send("directory-path", filePaths);
		}
	});

	ipcMain.on("select-config", async () => {
		if (!appState.secondaryWindow) return;
		const {canceled, filePaths} = await dialog.showOpenDialog(
			appState.secondaryWindow,
			{properties: ["openFile"]}
		);
		if (!canceled && filePaths.length > 0) {
			appState.secondaryWindow.webContents.send("configPath", filePaths);
		}
	});

	ipcMain.on("useTray", (_event, enabled) => {
		appState.trayEnabled = enabled;
		if (enabled) createTray();
		else {
			appState.tray?.destroy();
			appState.tray = null;
		}
	});

	ipcMain.on("progress", (_event, percentage) => {
		if (appState.mainWindow) appState.mainWindow.setProgressBar(percentage);
	});

	ipcMain.on("error_dialog", async (_event, message) => {
		const {response} = await dialog.showMessageBox(appState.mainWindow, {
			type: "error",
			title: "Error",
			message: message,
			buttons: ["Ok", i18n("clickToCopy")],
		});
		if (response === 1) clipboard.writeText(message);
	});

	ipcMain.handle("get-system-locale", async (_event) => {
		return app.getSystemLocale();
	});

	ipcMain.handle("get-translation", (_event, locale) => {
		const fallbackFile = path.join(__dirname, "translations", "en.json");
		const localeFile = path.join(
			__dirname,
			"translations",
			`${locale}.json`
		);

		const fallbackData = JSON.parse(readFileSync(fallbackFile, "utf8"));

		let localeData = {};
		if (locale !== "en" && existsSync(localeFile)) {
			try {
				localeData = JSON.parse(readFileSync(localeFile, "utf8"));
			} catch (e) {
				console.error(`Could not parse ${localeFile}`, e);
			}
		}

		const mergedTranslations = {...fallbackData, ...localeData};

		return mergedTranslations;
	});

	ipcMain.handle("get-download-history", () =>
		appState.downloadHistory.getHistory()
	);
	ipcMain.handle("add-to-history", (_, info) =>
		appState.downloadHistory.addDownload(info)
	);
	ipcMain.handle("get-download-stats", () =>
		appState.downloadHistory.getStats()
	);
	ipcMain.handle("delete-history-item", (_, id) =>
		appState.downloadHistory.removeHistoryItem(id)
	);
	ipcMain.handle("clear-all-history", async () => {
		await appState.downloadHistory.clearHistory();
		return true;
	});
	ipcMain.handle("export-history-json", () =>
		appState.downloadHistory.exportAsJSON()
	);
	ipcMain.handle("export-history-csv", () =>
		appState.downloadHistory.exportAsCSV()
	);
}

function registerAutoUpdaterEvents() {
	autoUpdater.on("update-available", async (info) => {
		const dialogOpts = {
			type: "info",
			buttons: [i18n("update"), i18n("no")],
			title: "Update Available",
			message: i18n("updateAvailablePrompt"),
			detail:
				info.releaseNotes?.toString().replace(/<[^>]*>?/gm, "") ||
				"No details available.",
		};
		const {response} = await dialog.showMessageBox(
			appState.mainWindow,
			dialogOpts
		);
		if (response === 0) {
			autoUpdater.downloadUpdate();
		}
	});

	autoUpdater.on("update-downloaded", async () => {
		appState.mainWindow.webContents.send("update-downloaded", "");
		const dialogOpts = {
			type: "info",
			buttons: [i18n("restart"), i18n("later")],
			title: "Update Ready",
			message: i18n("installAndRestartPrompt"),
		};
		const {response} = await dialog.showMessageBox(
			appState.mainWindow,
			dialogOpts
		);
		if (response === 0) {
			autoUpdater.quitAndInstall();
		}
	});

	autoUpdater.on("download-progress", async (info) => {
		appState.mainWindow.webContents.send("download-progress", info.percent);
	});

	autoUpdater.on("error", (error) => {
		console.error("Auto-update error:", error);
		dialog.showErrorBox("Update Error", i18n("updateError"));
	});
}

/**
 * @param {string} phrase The key to translate.
 * @returns {string} The translated string or the key itself.
 */
function i18n(phrase) {
	return appState.loadedLanguage[phrase] || phrase;
}

/**
 * Loads the configuration from the config file.
 */
async function loadConfiguration() {
	try {
		const fileContent = await fs.readFile(CONFIG_FILE_PATH, "utf8");
		appState.config = JSON.parse(fileContent);
	} catch (error) {
		console.log(
			"Could not load config file, using defaults.",
			error.message
		);
		appState.config = {
			bounds: {width: 1024, height: 768},
			isMaximized: false,
		};
	}
}

async function saveConfiguration() {
	try {
		await fs.writeFile(CONFIG_FILE_PATH, JSON.stringify(appState.config));
	} catch (error) {
		console.error("Failed to save configuration:", error);
	}
}

async function loadTranslations() {
	const locale = app.getSystemLocale();
	console.log({locale});
	const defaultLangPath = path.join(__dirname, "translations", "en.json");
	let langPath = path.join(__dirname, "translations", `${locale}.json`);

	try {
		await fs.access(langPath);
	} catch {
		langPath = defaultLangPath;
	}

	try {
		const fileContent = await fs.readFile(langPath, "utf8");
		appState.loadedLanguage = JSON.parse(fileContent);
	} catch (error) {
		console.error("Failed to load translation file:", error);
		appState.loadedLanguage = {};
	}
}


================================================
FILE: package.json
================================================
{
	"dependencies": {
		"electron-updater": "^6.6.2",
		"systeminformation": "^5.25.11",
		"yt-dlp-wrap-plus": "^2.4.3"
	},
	"name": "ytdownloader",
	"version": "3.20.2",
	"main": "main.js",
	"scripts": {
		"start": "electron .",
		"dist": "electron-builder",
		"debug": "electron --inspect=5858 .",
		"windows": "electron-builder -w",
		"linux": "electron-builder -l",
		"mac": "electron-builder -m",
		"gh-windows": "electron-builder -w --publish=always",
		"gh-linux": "electron-builder -l --publish=always",
		"gh-mac": "electron-builder -m --publish=always"
	},
	"author": {
		"name": "Andrew",
		"email": "aandrew.me@pm.me"
	},
	"publish": {
		"provider": "github",
		"owner": "aandrew-me",
		"repo": "ytDownloader",
		"private": false
	},
	"license": "GPL-3.0",
	"description": "Download videos and audios from YouTube and many other sites",
	"devDependencies": {
		"electron": "^30.0.0",
		"electron-builder": "^26.0.12",
		"typescript": "^5.3.3"
	},
	"build": {
		"productName": "YTDownloader",
		"appId": "io.github.aandrew_me.ytdn",
		"artifactName": "${productName}.${ext}",
		"files": [
			"./resources/**/*",
			"main.js",
			"./html/**/*",
			"./resources/**/*",
			"./public/**/*",
			"package.json",
			"./assets/**/*",
			"./src/*.js",
			"./ffmpeg/**/*",
			"!ffmpeg.patch",
			"translations",
			"node*"
		],
		"electronLanguages": [
			"en-US"
		],
		"mac": {
			"category": "Utility",
			"target": [
				"zip",
				"dmg"
			],
			"artifactName": "${productName}_Mac_${arch}.${ext}"
		},
		"dmg": {
			"contents": [
				{
					"x": 130,
					"y": 220
				},
				{
					"x": 410,
					"y": 220,
					"type": "link",
					"path": "/Applications"
				}
			],
			"sign": false
		},
		"asar": false,
		"directories": {
			"buildResources": "resources",
			"output": "release"
		},
		"linux": {
			"target": [
				"Appimage",
				"snap",
				"rpm",
				"zip",
				"deb"
			],
			"category": "Utility",
			"artifactName": "${productName}_Linux.${ext}"
		},
		"snap": {
			"grade": "stable",
			"base": "core22"
		},
		"win": {
			"target": [
				"nsis",
				"msi",
				"zip"
			],
			"artifactName": "${productName}_Win.${ext}"
		},
		"nsis": {
			"allowToChangeInstallationDirectory": true,
			"oneClick": false,
			"deleteAppDataOnUninstall": true
		},
		"msi": {
			"oneClick": true,
			"createDesktopShortcut": true,
			"createStartMenuShortcut": true,
			"shortcutName": "YTDownloader"
		}
	}
}


================================================
FILE: src/common.js
================================================
const electron = require("electron");
/**
 *
 * @param {string} id
 * @returns {any}
 */
function getId(id) {
	return document.getElementById(id);
}

getId("menuIcon").addEventListener("click", () => {
	const menuDisplay = getId("menu").style.display;
	if (menuDisplay != "none" && menuDisplay != "") {
		getId("menuIcon").style.transform = "rotate(0deg)";
		let count = 0;
		let opacity = 1;
		const fade = setInterval(() => {
			if (count >= 10) {
				getId("menu").style.display = "none";
				clearInterval(fade);
			} else {
				opacity -= 0.1;
				getId("menu").style.opacity = opacity.toFixed(3).toString();
				count++;
			}
		}, 50);
	} else {
		getId("menuIcon").style.transform = "rotate(90deg)";

		setTimeout(() => {
			getId("menu").style.display = "flex";
			getId("menu").style.opacity = "1";
		}, 150);
	}
});

getId("themeToggle").addEventListener("change", () => {
	localStorage.setItem("theme", getId("themeToggle").value);

	const x = window.innerWidth;
	const y = 0;
	const maxRadius = Math.hypot(window.innerWidth, window.innerHeight);

	const transition = document.startViewTransition(() => {
		document.documentElement.setAttribute("theme", getId("themeToggle").value);
	});

	transition.ready.then(() => {
	  document.documentElement.animate(
		{
		  clipPath: [
			`circle(0px at ${x}px ${y}px)`,
			`circle(${maxRadius}px at ${x}px ${y}px)`
		  ]
		},
		{
		  duration: 1100,
		  easing: 'cubic-bezier(0.4, 0, 0.2, 1)',
		  pseudoElement: '::view-transition-new(root)'
		}
	  );
	});
});

const storageTheme = localStorage.getItem("theme");
if (storageTheme) {
	document.documentElement.setAttribute("theme", storageTheme);
	getId("themeToggle").value = storageTheme;
} else {
	getId("themeToggle").value = "frappe";
	document.documentElement.setAttribute("theme", "frappe");
}

////
let advancedHidden = true;

function advancedToggle() {
	if (advancedHidden) {
		getId("advanced").style.display = "block";
		advancedHidden = false;
	} else {
		getId("advanced").style.display = "none";
		advancedHidden = true;
	}
}

// Check scroll go to top

window.onscroll = function () {
	scrollFunction();
};

function scrollFunction() {
	if (
		document.body.scrollTop > 50 ||
		document.documentElement.scrollTop > 50
	) {
		getId("goToTop").style.display = "block";
	} else {
		getId("goToTop").style.display = "none";
	}
}

// Function to scroll go to top

getId("goToTop").addEventListener("click", () => {
	window.scrollTo({top: 0, behavior: "smooth"});
});

// Showing and hiding error details
function toggleErrorDetails() {
	const status = getId("errorDetails").style.display;
	if (status === "none") {
		getId("errorDetails").style.display = "block";
		// @ts-ignore
		getId("errorBtn").textContent = i18n.__("errorDetails") + " ▲";
	} else {
		getId("errorDetails").style.display = "none";
		// @ts-ignore
		getId("errorBtn").textContent = i18n.__("errorDetails") + " ▼";
	}
}

================================================
FILE: src/compressor.js
================================================
const {exec, execSync} = require("child_process");
const path = require("path");
const {ipcRenderer, shell} = require("electron");
const os = require("os");
const si = require("systeminformation");
const {existsSync} = require("fs");

document.addEventListener("translations-loaded", () => {
	window.i18n.translatePage();
});

let menuIsOpen = false;

getId("menuIcon").addEventListener("click", () => {
	if (menuIsOpen) {
		getId("menuIcon").style.transform = "rotate(0deg)";
		menuIsOpen = false;
		let count = 0;
		let opacity = 1;
		const fade = setInterval(() => {
			if (count >= 10) {
				getId("menu").style.display = "none";
				clearInterval(fade);
			} else {
				opacity -= 0.1;
				getId("menu").style.opacity = opacity.toFixed(3).toString();
				count++;
			}
		}, 50);
	} else {
		getId("menuIcon").style.transform = "rotate(90deg)";
		menuIsOpen = true;

		setTimeout(() => {
			getId("menu").style.display = "flex";
			getId("menu").style.opacity = "1";
		}, 150);
	}
});

const ffmpeg = `"${getFfmpegPath()}"`;

console.log(ffmpeg);

const vaapi_device = "/dev/dri/renderD128";

// Checking GPU
si.graphics().then((info) => {
	console.log({gpuInfo: info});
	const gpuDevices = info.controllers;

	gpuDevices.forEach((gpu) => {
		// NVIDIA
		const gpuName = gpu.vendor.toLowerCase();
		const gpuModel = gpu.model.toLowerCase();

		if (gpuName.includes("nvidia") || gpuModel.includes("nvidia")) {
			document.querySelectorAll(".nvidia_opt").forEach((opt) => {
				opt.style.display = "block";
			});
		} else if (
			gpuName.includes("advanced micro devices") ||
			gpuModel.includes("amd")
		) {
			if (os.platform() == "win32") {
				document.querySelectorAll(".amf_opt").forEach((opt) => {
					opt.style.display = "block";
				});
			} else {
				document.querySelectorAll(".vaapi_opt").forEach((opt) => {
					opt.style.display = "block";
				});
			}
		} else if (gpuName.includes("intel")) {
			if (os.platform() == "win32") {
				document.querySelectorAll(".qsv_opt").forEach((opt) => {
					opt.style.display = "block";
				});
			} else if (os.platform() != "darwin") {
				document.querySelectorAll(".vaapi_opt").forEach((opt) => {
					opt.style.display = "block";
				});
			}
		} else {
			if (os.platform() == "darwin") {
				document
					.querySelectorAll(".videotoolbox_opt")
					.forEach((opt) => {
						opt.style.display = "block";
					});
			}
		}
	});
});

/** @type {File[]} */
let files = [];
let activeProcesses = new Set();
let currentItemId = "";
let isCancelled = false;

/**
 * @param {string} id
 */
function getId(id) {
	return document.getElementById(id);
}

// File Handling
const dropZone = document.querySelector(".drop-zone");
const fileInput = getId("fileInput");
const selectedFilesDiv = getId("selected-files");

dropZone.addEventListener("dragover", (e) => {
	e.preventDefault();
	dropZone.classList.add("dragover");
});

dropZone.addEventListener("dragleave", () => {
	dropZone.classList.remove("dragover");
});

dropZone.addEventListener("drop", (e) => {
	e.preventDefault();
	dropZone.classList.remove("dragover");
	// @ts-ignore
	console.log(e.dataTransfer);
	files = Array.from(e.dataTransfer.files);
	updateSelectedFiles();
});

fileInput.addEventListener("change", (e) => {
	// @ts-ignore
	files = Array.from(e.target.files);
	updateSelectedFiles();
});

getId("custom-folder-select").addEventListener("click", (e) => {
	ipcRenderer.send("get-directory", "");
});

function updateSelectedFiles() {
	const fileList = files
		.map((f) => `${f.name} (${formatBytes(f.size)})<br/>`)
		.join("\n");
	selectedFilesDiv.innerHTML = fileList || "No files selected";
}

// Compression Logic
getId("compress-btn").addEventListener("click", startCompression);
getId("cancel-btn").addEventListener("click", cancelCompression);

async function startCompression() {
	if (files.length === 0) return alert("Please select files first!");

	const settings = getEncoderSettings();

	for (const file of files) {
		const itemId =
			"f" + Math.random().toFixed(10).toString().slice(2).toString();
		currentItemId = itemId;

		const outputPath = generateOutputPath(file, settings);

		try {
			await compressVideo(file, settings, itemId, outputPath);

			if (isCancelled) {
				isCancelled = false;
			} else {
				updateProgress("success", "", itemId);
				const fileSavedElement = document.createElement("b");
				fileSavedElement.textContent = i18n.__("fileSavedClickToOpen");
				fileSavedElement.onclick = () => {
					ipcRenderer.send("show-file", outputPath);
				};
				getId(itemId + "_prog").appendChild(fileSavedElement);
				currentItemId = "";
			}
		} catch (error) {
			const errorElement = document.createElement("div");
			errorElement.onclick = () => {
				ipcRenderer.send("error_dialog", error.message);
			};
			errorElement.textContent = i18n.__("errorClickForDetails");
			updateProgress("error", "", itemId);
			getId(itemId + "_prog").appendChild(errorElement);
			currentItemId = "";
		}
	}
}

function cancelCompression() {
	activeProcesses.forEach((child) => {
		child.stdin.write("q");
		isCancelled = true;
	});
	activeProcesses.clear();
	updateProgress("error", "Cancelled", currentItemId);
}

/**
 * @param {File} file
 */
function generateOutputPath(file, settings) {
	console.log({settings});
	const output_extension = settings.extension;
	const parsed_file = path.parse(file.path);

	let outputDir = settings.outputPath || parsed_file.dir;

	if (output_extension == "unchanged") {
		return path.join(
			outputDir,
			`${parsed_file.name}${settings.outputSuffix}${parsed_file.ext}`
		);
	}

	return path.join(
		outputDir,
		`${parsed_file.name}_compressed.${output_extension}`
	);
}

/**
 * @param {File} file
 * @param {{ encoder: any; speed: any; videoQuality: any; audioQuality?: any; audioFormat: string, extension: string }} settings
 * @param {string} itemId
 * @param {string} outputPath
 */
async function compressVideo(file, settings, itemId, outputPath) {
	const command = buildFFmpegCommand(file, settings, outputPath);

	console.log("Command: " + command);

	return new Promise((resolve, reject) => {
		const child = exec(command, (error) => {
			if (error) reject(error);
			else resolve();
		});

		activeProcesses.add(child);
		child.on("exit", (_code) => {
			activeProcesses.delete(child);
		});

		let video_info = {
			duration: "",
			bitrate: "",
		};

		createProgressItem(
			path.basename(file.path),
			"progress",
			`Starting...`,
			itemId
		);

		child.stderr.on("data", (data) => {
			// console.log(data)
			const duration_match = data.match(/Duration:\s*([\d:.]+)/);
			if (duration_match) {
				video_info.duration = duration_match[1];
			}

			// const bitrate_match = data.match(/bitrate:\s*([\d:.]+)/);
			// if (bitrate_match) {
			// 	// Bitrate in kb/s
			// 	video_info.bitrate = bitrate_match[1];
			// }

			const progressTime = data.match(/time=(\d+:\d+:\d+\.\d+)/);

			const totalSeconds = timeToSeconds(video_info.duration);

			const currentSeconds =
				progressTime && progressTime.length > 1
					? timeToSeconds(progressTime[1])
					: null;

			if (currentSeconds && !isCancelled) {
				const progress = Math.round(
					(currentSeconds / totalSeconds) * 100
				);

				getId(
					itemId + "_prog"
				).innerHTML = `<progress class="progressBarCompress" min=0 max=100 value=${progress}>`;
			}
		});
	});
}

/**
 * @param {File} file
 * @param {{ encoder: string; speed: string; videoQuality: string; audioQuality: string; audioFormat: string }} settings
 * @param {string} outputPath
 */
function buildFFmpegCommand(file, settings, outputPath) {
	const inputPath = file.path;

	console.log("Output path: " + outputPath);

	const args = ["-hide_banner", "-y", "-stats", "-i", `"${inputPath}"`];

	switch (settings.encoder) {
		case "copy":
			args.push("-c:v", "copy");
			break;
		case "x264":
			args.push(
				"-c:v",
				"libx264",
				"-preset",
				settings.speed,
				"-vf",
				"format=yuv420p",
				"-crf",
				parseInt(settings.videoQuality).toString()
			);
			break;
		case "x265":
			args.push(
				"-c:v",
				"libx265",
				"-vf",
				"format=yuv420p",
				"-preset",
				settings.speed,
				"-crf",
				parseInt(settings.videoQuality).toString()
			);
			break;
		// Intel windows
		case "qsv":
			args.push(
				"-c:v",
				"h264_qsv",
				"-vf",
				"format=yuv420p",
				"-preset",
				settings.speed,
				"-global_quality",
				parseInt(settings.videoQuality).toString()
			);
			break;
		// Linux amd and intel
		case "vaapi":
			args.push(
				"-vaapi_device",
				vaapi_device,
				"-vf",
				"format=nv12,hwupload",
				"-c:v",
				"h264_vaapi",
				"-qp",
				parseInt(settings.videoQuality).toString()
			);
			break;
		case "hevc_vaapi":
			args.push(
				"-vaapi_device",
				vaapi_device,
				"-vf",
				"format=nv12,hwupload",
				"-c:v",
				"hevc_vaapi",
				"-qp",
				parseInt(settings.videoQuality).toString()
			);
			break;
		// Nvidia windows and linux
		case "nvenc":
			args.push(
				"-c:v",
				"h264_nvenc",
				"-vf",
				"format=yuv420p",
				"-preset",
				getNvencPreset(settings.speed),
				"-rc",
				"vbr",
				"-cq",
				parseInt(settings.videoQuality).toString()
			);
			break;
		// Amd windows
		case "hevc_amf":
			let amf_hevc_quality = "balanced";

			if (settings.speed == "slow") {
				amf_hevc_quality = "quality";
			} else if (settings.speed == "fast") {
				amf_hevc_quality = "speed";
			}

			args.push(
				"-c:v",
				"hevc_amf",
				"-vf",
				"format=yuv420p",
				"-quality",
				amf_hevc_quality,
				"-rc",
				"cqp",
				"-qp_i",
				parseInt(settings.videoQuality).toString(),
				"-qp_p",
				parseInt(settings.videoQuality).toString()
			);
			break;
		case "amf":
			let amf_quality = "balanced";

			if (settings.speed == "slow") {
				amf_quality = "quality";
			} else if (settings.speed == "fast") {
				amf_quality = "speed";
			}

			args.push(
				"-c:v",
				"h264_amf",
				"-vf",
				"format=yuv420p",
				"-quality",
				amf_quality,
				"-rc",
				"cqp",
				"-qp_i",
				parseInt(settings.videoQuality).toString(),
				"-qp_p",
				parseInt(settings.videoQuality).toString(),
				"-qp_b",
				parseInt(settings.videoQuality).toString()
			);
			break;
		case "videotoolbox":
			args.push(
				"-c:v",
				"-vf",
				"format=yuv420p",
				"h264_videotoolbox",
				"-q:v",
				parseInt(settings.videoQuality).toString()
			);
			break;
	}

	// args.push("-vf", "scale=trunc(iw*1/2)*2:trunc(ih*1/2)*2,format=yuv420p");

	args.push("-c:a", settings.audioFormat, `"${outputPath}"`);

	return `${ffmpeg} ${args.join(" ")}`;
}

/**
 *
 * @returns {{ encoder: string; speed: string; videoQuality: string; audioQuality?: string; audioFormat: string, extension: string, outputPath:string }} settings
 */
function getEncoderSettings() {
	return {
		// @ts-ignore
		encoder: getId("encoder").value,
		// @ts-ignore
		speed: getId("compression-speed").value,
		// @ts-ignore
		videoQuality: getId("video-quality").value,
		// @ts-ignore
		audioFormat: getId("audio-format").value,
		// @ts-ignore
		extension: getId("file_extension").value,
		outputPath: getId("custom-folder-path").textContent,
		// @ts-ignore
		outputSuffix: getId("output-suffix").value,
	};
}

/**
 * @param {string | number} speed
 */
function getNvencPreset(speed) {
	const presets = {fast: "p3", medium: "p4", slow: "p5"};
	return presets[speed] || "p4";
}

/**
 * @param {string} status
 * @param {string} data
 * @param {string} itemId
 */
function updateProgress(status, data, itemId) {
	if (status == "success" || status == "error") {
		const item = getId("itemId");

		if (item) {
			getId(itemId).classList.remove("progress");
			getId(itemId).classList.add(status);
		}
	}

	if (itemId) {
		getId(itemId + "_prog").textContent = data;
	}
}

/**
 * @param {string} filename
 * @param {string} status
 * @param {string} data
 * @param {string} itemId
 */
function createProgressItem(filename, status, data, itemId) {
	const statusElement = getId("compression-status");
	const newStatus = document.createElement("div");
	newStatus.id = itemId;
	newStatus.className = `status-item ${status}`;
	const visibleFilename = filename.substring(0, 45);
	newStatus.innerHTML = `
        <div class="filename">${visibleFilename}</div>
        <div id="${itemId + "_prog"}" class="itemProgress">${data}</div>
    `;
	statusElement.append(newStatus);
}

/**
 * @param {any} bytes
 */
function formatBytes(bytes) {
	const units = ["B", "KB", "MB", "GB"];
	let size = bytes;
	let unitIndex = 0;
	while (size >= 1024 && unitIndex < units.length - 1) {
		size /= 1024;
		unitIndex++;
	}
	return `${size.toFixed(2)} ${units[unitIndex]}`;
}

/**
 * @param {string} timeStr
 */
function timeToSeconds(timeStr) {
	if (!timeStr) {
		return 0;
	}

	const [hh, mm, ss] = timeStr.split(":").map(parseFloat);
	return hh * 3600 + mm * 60 + ss;
}

function getFfmpegPath() {
	if (
		process.env.YTDOWNLOADER_FFMPEG_PATH &&
		existsSync(process.env.YTDOWNLOADER_FFMPEG_PATH)
	) {
		console.log("Using FFMPEG from YTDOWNLOADER_FFMPEG_PATH");
		return process.env.YTDOWNLOADER_FFMPEG_PATH;
	}

	switch (os.platform()) {
		case "win32":
			return path.join(__dirname, "..", "ffmpeg", "bin", "ffmpeg.exe");
		case "freebsd":
			try {
				return execSync("which ffmpeg").toString("utf8").trim();
			} catch (error) {
				console.error("ffmpeg not found on FreeBSD:", error);
				return "";
			}
		default:
			return path.join(__dirname, "..", "ffmpeg", "bin", "ffmpeg");
	}
}

getId("themeToggle").addEventListener("change", () => {
	document.documentElement.setAttribute("theme", getId("themeToggle").value);
	localStorage.setItem("theme", getId("themeToggle").value);
});

getId("output-folder-input").addEventListener("change", (e) => {
	const checked = e.target.checked;

	if (!checked) {
		getId("custom-folder-select").style.display = "block";
	} else {
		getId("custom-folder-select").style.display = "none";
		getId("custom-folder-path").textContent = "";
		getId("custom-folder-path").style.display = "none";
	}
});

const storageTheme = localStorage.getItem("theme");
if (storageTheme) {
	document.documentElement.setAttribute("theme", storageTheme);
	getId("themeToggle").value = storageTheme;
} else {
	document.documentElement.setAttribute("theme", "frappe");
	getId("themeToggle").value = "frappe";
}

ipcRenderer.on("directory-path", (_event, msg) => {
	let customFolderPathItem = getId("custom-folder-path");

	customFolderPathItem.textContent = msg;
	customFolderPathItem.style.display = "inline";
});

function closeMenu() {
	getId("menuIcon").style.transform = "rotate(0deg)";
	let count = 0;
	let opacity = 1;
	const fade = setInterval(() => {
		if (count >= 10) {
			clearInterval(fade);
		} else {
			opacity -= 0.1;
			getId("menu").style.opacity = String(opacity);
			count++;
		}
	}, 50);
}

// Menu
getId("preferenceWin").addEventListener("click", () => {
	closeMenu();
	menuIsOpen = false;
	ipcRenderer.send("load-page", __dirname + "/preferences.html");
});

getId("playlistWin").addEventListener("click", () => {
	closeMenu();
	menuIsOpen = false;
	ipcRenderer.send("load-win", __dirname + "/playlist.html");
});

getId("aboutWin").addEventListener("click", () => {
	closeMenu();
	menuIsOpen = false;
	ipcRenderer.send("load-page", __dirname + "/about.html");
});

getId("historyWin").addEventListener("click", () => {
	closeMenu();
	menuIsOpen = false;
	ipcRenderer.send("load-page", __dirname + "/history.html");
});

getId("homeWin").addEventListener("click", () => {
	closeMenu();
	menuIsOpen = false;
	ipcRenderer.send("load-win", __dirname + "/index.html");
});


================================================
FILE: src/history.js
================================================
/**
 * Download History Manager
 */

const fs = require("fs");
const path = require("path");
const crypto = require("crypto");
const {app} = require("electron");

class DownloadHistory {
	constructor() {
		this.historyFile = path.join(
			app.getPath("userData"),
			"download_history.json"
		);
		this.maxHistoryItems = 800;
		this.history = [];
		this.initialized = this._loadHistory().then((history) => {
			this.history = history;
		});
	}
	_generateUniqueId() {
		return crypto.randomUUID();
	}

	async _loadHistory() {
		try {
			if (fs.existsSync(this.historyFile)) {
				const data = await fs.promises.readFile(
					this.historyFile,
					"utf8"
				);
				return JSON.parse(data) || [];
			}
		} catch (error) {
			console.error("Error loading history:", error);
		}
		return [];
	}

	async _saveHistory() {
		try {
			await fs.promises.writeFile(
				this.historyFile,
				JSON.stringify(this.history, null, 2)
			);
		} catch (error) {
			console.error("Error saving history:", error);
		}
	}

	async addDownload(downloadInfo) {
		await this.initialized;

		const historyItem = {
			id: this._generateUniqueId(),
			title: downloadInfo.title || "Unknown",
			url: downloadInfo.url || "",
			filename: downloadInfo.filename || "",
			filePath: downloadInfo.filePath || "",
			fileSize: downloadInfo.fileSize || 0,
			format: downloadInfo.format || "unknown",
			thumbnail: downloadInfo.thumbnail || "",
			duration: downloadInfo.duration || 0,
			downloadDate: new Date().toISOString(),
			timestamp: Date.now(),
		};

		// Add to beginning for most recent first
		this.history.unshift(historyItem);

		// Keep only recent items
		if (this.history.length > this.maxHistoryItems) {
			this.history = this.history.slice(0, this.maxHistoryItems);
		}

		await this._saveHistory();
		return historyItem;
	}

	async getHistory() {
		await this.initialized;
		return this.history;
	}

	async getFilteredHistory(options = {}) {
		await this.initialized;

		let filtered = [...this.history];

		if (options.format) {
			filtered = filtered.filter(
				(item) =>
					item.format.toLowerCase() === options.format.toLowerCase()
			);
		}

		if (options.searchTerm) {
			const term = options.searchTerm.toLowerCase();
			filtered = filtered.filter(
				(item) =>
					item.title.toLowerCase().includes(term) ||
					item.url.toLowerCase().includes(term)
			);
		}

		if (options.limit) {
			filtered = filtered.slice(0, options.limit);
		}

		return filtered;
	}

	async getHistoryItem(id) {
		await this.initialized;
		return this.history.find((item) => item.id === id) || null;
	}

	async removeHistoryItem(id) {
		await this.initialized;

		const index = this.history.findIndex((item) => item.id === id);
		if (index !== -1) {
			this.history.splice(index, 1);
			await this._saveHistory();
			return true;
		}
		return false;
	}

	async clearHistory() {
		await this.initialized;

		this.history = [];
		await this._saveHistory();
	}

	async getStats() {
		await this.initialized;

		const stats = {
			totalDownloads: this.history.length,
			totalSize: 0,
			byFormat: {},
			oldestDownload: null,
			newestDownload: null,
		};

		this.history.forEach((item) => {
			stats.totalSize += item.fileSize || 0;

			const fmt = item.format.toLowerCase();
			stats.byFormat[fmt] = (stats.byFormat[fmt] || 0) + 1;
		});

		if (this.history.length > 0) {
			stats.newestDownload = this.history[0];
			stats.oldestDownload = this.history[this.history.length - 1];
		}

		return stats;
	}

	async exportAsJSON() {
		await this.initialized;
		return JSON.stringify(this.history, null, 2);
	}

	_sanitizeCSVField(value) {
		if (value == null) {
			value = "";
		}

		const stringValue = String(value);

		let sanitized = stringValue.replace(/"/g, '""');

		const dangerousChars = ["=", "+", "-", "@"];
		if (sanitized.length > 0 && dangerousChars.includes(sanitized[0])) {
			sanitized = "'" + sanitized;
		}

		return `"${sanitized}"`;
	}

	async exportAsCSV() {
		await this.initialized;

		if (this.history.length === 0) return "No history to export\n";

		const headers = [
			"Title",
			"URL",
			"Filename",
			"Format",
			"File Size (bytes)",
			"Download Date",
		];
		const rows = this.history.map((item) => [
			this._sanitizeCSVField(item.title),
			this._sanitizeCSVField(item.url),
			this._sanitizeCSVField(item.filename),
			this._sanitizeCSVField(item.format),
			this._sanitizeCSVField(item.fileSize),
			this._sanitizeCSVField(item.downloadDate),
		]);

		return (
			headers.join(",") +
			"\n" +
			rows.map((row) => row.join(",")).join("\n")
		);
	}
}

module.exports = DownloadHistory;


================================================
FILE: src/index.js
================================================
const videoToggle = getId("videoToggle");
const audioToggle = getId("audioToggle");
const incorrectMsg = getId("incorrectMsg");
const loadingMsg = getId("loadingWrapper");

function getId(id) {
	return document.getElementById(id);
}

// Video and audio toggle

videoToggle.addEventListener("click", (event) => {
	selectVideo()
});

audioToggle.addEventListener("click", (event) => {
	selectAudio()
});

/////////////
function selectVideo(){
	localStorage.setItem("defaultWindow", "video")
	videoToggle.style.backgroundColor = "var(--box-toggleOn)";
	audioToggle.style.backgroundColor = "var(--box-toggle)";
	getId("audioList").style.display = "none";
	getId("audioExtract").style.display = "none";
	getId("videoList").style.display = "block";
}

function selectAudio(){
	localStorage.setItem("defaultWindow", "audio")
	audioToggle.style.backgroundColor = "var(--box-toggleOn)";
	videoToggle.style.backgroundColor = "var(--box-toggle)";
	getId("videoList").style.display = "none";
	getId("audioList").style.display = "block";
	getId("audioExtract").style.display = "block";
}

================================================
FILE: src/playlist.js
================================================
const {clipboard, ipcRenderer} = require("electron");
const {default: YTDlpWrap} = require("yt-dlp-wrap-plus");
const path = require("path");
const os = require("os");
const fs = require("fs");
const {execSync} = require("child_process");
const {constants} = require("fs/promises");

const playlistDownloader = {
	// State and config
	state: {
		url: null,
		downloadDir: null,
		ytDlpPath: null,
		ytDlpWrap: null,
		ffmpegPath: null,
		jsRuntimePath: null,
		playlistName: "",
		originalCount: 0,
		currentDownloadProcess: null,
	},

	config: {
		foldernameFormat: "%(playlist_title)s",
		filenameFormat: "%(playlist_index)s.%(title)s.%(ext)s",
		proxy: "",
		cookie: {
			browser: "",
			arg: "",
		},
		configFile: {
			arg: "",
			path: "",
		},
		playlistRange: {
			start: 1,
			end: "",
		},
	},

	// DOM elements
	ui: {
		pasteLinkBtn: document.getElementById("pasteLink"),
		linkDisplay: document.getElementById("link"),
		optionsContainer: document.getElementById("options"),
		downloadList: document.getElementById("list"),

		downloadVideoBtn: document.getElementById("download"),
		downloadAudioBtn: document.getElementById("audioDownload"),
		downloadThumbnailsBtn: document.getElementById("downloadThumbnails"),
		saveLinksBtn: document.getElementById("saveLinks"),

		selectLocationBtn: document.getElementById("selectLocation"),
		pathDisplay: document.getElementById("path"),
		openDownloadsBtn: document.getElementById("openDownloads"),

		videoToggle: document.getElementById("videoToggle"),
		audioToggle: document.getElementById("audioToggle"),
		advancedToggle: document.getElementById("advancedToggle"),
		videoBox: document.getElementById("videoBox"),
		audioBox: document.getElementById("audioBox"),
		videoQualitySelect: document.getElementById("select"),
		videoTypeSelect: document.getElementById("videoTypeSelect"),
		typeSelectBox: document.getElementById("typeSelectBox"),
		audioTypeSelect: document.getElementById("audioSelect"),
		audioQualitySelect: document.getElementById("audioQualitySelect"),

		advancedMenu: document.getElementById("advancedMenu"),
		playlistIndexInput: document.getElementById("playlistIndex"),
		playlistEndInput: document.getElementById("playlistEnd"),
		subtitlesCheckbox: document.getElementById("subChecked"),
		closeHiddenBtn: document.getElementById("closeHidden"),

		playlistNameDisplay: document.getElementById("playlistName"),
		errorMsgDisplay: document.getElementById("incorrectMsgPlaylist"),
		errorBtn: document.getElementById("errorBtn"),
		errorDetails: document.getElementById("errorDetails"),

		menuIcon: document.getElementById("menuIcon"),
		menu: document.getElementById("menu"),
		preferenceWinBtn: document.getElementById("preferenceWin"),
		aboutWinBtn: document.getElementById("aboutWin"),
		historyWinBtn: document.getElementById("historyWin"),
		homeWinBtn: document.getElementById("homeWin"),
		compressorWinBtn: document.getElementById("compressorWin"),
	},

	init() {
		this.loadInitialConfig();
		this.initEventListeners();

		// Set initial UI state
		this.ui.pathDisplay.textContent = this.state.downloadDir;
		this.ui.videoToggle.style.backgroundColor = "var(--box-toggleOn)";
		this.updateVideoTypeVisibility();

		// Load translations when ready
		document.addEventListener("translations-loaded", () => {
			window.i18n.translatePage();
		});

		console.log(`yt-dlp path: ${this.state.ytDlpPath}`);
		console.log(`ffmpeg path: ${this.state.ffmpegPath}`);
	},

	loadInitialConfig() {
		// yt-dlp path
		this.state.ytDlpPath = localStorage.getItem("ytdlp");
		this.state.ytDlpWrap = new YTDlpWrap(`"${this.state.ytDlpPath}"`);

		const defaultDownloadsDir = path.join(os.homedir(), "Downloads");
		let preferredDir =
			localStorage.getItem("downloadPath") || defaultDownloadsDir;
		try {
			fs.accessSync(preferredDir, constants.W_OK);
			this.state.downloadDir = preferredDir;
		} catch (err) {
			console.error(
				"Unable to write to preferred download directory. Reverting to default.",
				err
			);
			this.state.downloadDir = defaultDownloadsDir;
			localStorage.setItem("downloadPath", defaultDownloadsDir);
		}

		// ffmpeg and js runtime path setup
		this.state.ffmpegPath = this.getFfmpegPath();
		this.state.jsRuntimePath = this.getJsRuntimePath();

		if (localStorage.getItem("preferredVideoQuality")) {
			this.ui.videoQualitySelect.value = localStorage.getItem(
				"preferredVideoQuality"
			);
		}
		if (localStorage.getItem("preferredAudioQuality")) {
			this.ui.audioQualitySelect.value = localStorage.getItem(
				"preferredAudioQuality"
			);
		}
	},

	initEventListeners() {
		this.ui.pasteLinkBtn.addEventListener("click", () => this.pasteLink());
		document.addEventListener("keydown", (event) => {
			if (
				(event.ctrlKey && event.key === "v") ||
				(event.metaKey &&
					event.key === "v" &&
					os.platform() === "darwin" &&
					document.activeElement.tagName !== "INPUT" &&
					document.activeElement.tagName !== "TEXTAREA")
			) {
				this.pasteLink();
			}
		});

		this.ui.downloadVideoBtn.addEventListener("click", () =>
			this.startDownload("video")
		);
		this.ui.downloadAudioBtn.addEventListener("click", () =>
			this.startDownload("audio")
		);
		this.ui.downloadThumbnailsBtn.addEventListener("click", () =>
			this.startDownload("thumbnails")
		);
		this.ui.saveLinksBtn.addEventListener("click", () =>
			this.startDownload("links")
		);

		this.ui.videoToggle.addEventListener("click", () =>
			this.toggleDownloadType("video
Download .txt
gitextract_gpcjyyrr/

├── .gitignore
├── LICENSE
├── README.md
├── assets/
│   └── css/
│       ├── extra.css
│       └── index.css
├── crowdin.yml
├── flatpak/
│   ├── io.github.aandrew_me.ytdn.desktop
│   └── io.github.aandrew_me.ytdn.metainfo.xml
├── html/
│   ├── about.html
│   ├── compressor.html
│   ├── history.html
│   ├── index.html
│   ├── playlist.html
│   ├── playlist_new.html
│   └── preferences.html
├── linux.sh
├── mac.sh
├── main.js
├── package.json
├── resources/
│   └── icon.icns
├── src/
│   ├── common.js
│   ├── compressor.js
│   ├── history.js
│   ├── index.js
│   ├── playlist.js
│   ├── playlist_new.js
│   ├── preferences.js
│   ├── renderer.js
│   └── types.d.ts
├── translations/
│   ├── ar-SA.json
│   ├── bn-BD.json
│   ├── de-DE.json
│   ├── el-GR.json
│   ├── en.json
│   ├── es-ES.json
│   ├── fa-IR.json
│   ├── fi-FI.json
│   ├── fr-FR.json
│   ├── hi-IN.json
│   ├── hu-HU.json
│   ├── i18n-init.js
│   ├── i18n.js
│   ├── it-IT.json
│   ├── ja-JP.json
│   ├── ne-NP.json
│   ├── pl-PL.json
│   ├── pt-BR.json
│   ├── ru-RU.json
│   ├── tr-TR.json
│   ├── uk-UA.json
│   ├── vi-VN.json
│   ├── zh-CN.json
│   └── zh-TW.json
├── tsconfig.json
├── windows.ps1
└── ytdownloader.json
Download .txt
SYMBOL INDEX (131 symbols across 11 files)

FILE: main.js
  constant USER_DATA_PATH (line 20) | const USER_DATA_PATH = app.getPath("userData");
  constant CONFIG_FILE_PATH (line 21) | const CONFIG_FILE_PATH = path.join(USER_DATA_PATH, "ytdownloader.json");
  function initialize (line 84) | async function initialize() {
  function createWindow (line 98) | function createWindow() {
  function createSecondaryWindow (line 153) | function createSecondaryWindow(file) {
  function createTray (line 186) | function createTray() {
  function registerIpcHandlers (line 254) | function registerIpcHandlers() {
  function registerAutoUpdaterEvents (line 443) | function registerAutoUpdaterEvents() {
  function i18n (line 494) | function i18n(phrase) {
  function loadConfiguration (line 501) | async function loadConfiguration() {
  function saveConfiguration (line 517) | async function saveConfiguration() {
  function loadTranslations (line 525) | async function loadTranslations() {

FILE: src/common.js
  function getId (line 7) | function getId(id) {
  function advancedToggle (line 77) | function advancedToggle() {
  function scrollFunction (line 93) | function scrollFunction() {
  function toggleErrorDetails (line 111) | function toggleErrorDetails() {

FILE: src/compressor.js
  function getId (line 105) | function getId(id) {
  function updateSelectedFiles (line 142) | function updateSelectedFiles() {
  function startCompression (line 153) | async function startCompression() {
  function cancelCompression (line 193) | function cancelCompression() {
  function generateOutputPath (line 205) | function generateOutputPath(file, settings) {
  function compressVideo (line 231) | async function compressVideo(file, settings, itemId, outputPath) {
  function buildFFmpegCommand (line 299) | function buildFFmpegCommand(file, settings, outputPath) {
  function getEncoderSettings (line 461) | function getEncoderSettings() {
  function getNvencPreset (line 482) | function getNvencPreset(speed) {
  function updateProgress (line 492) | function updateProgress(status, data, itemId) {
  function createProgressItem (line 513) | function createProgressItem(filename, status, data, itemId) {
  function formatBytes (line 529) | function formatBytes(bytes) {
  function timeToSeconds (line 543) | function timeToSeconds(timeStr) {
  function getFfmpegPath (line 552) | function getFfmpegPath() {
  function closeMenu (line 609) | function closeMenu() {

FILE: src/history.js
  class DownloadHistory (line 10) | class DownloadHistory {
    method constructor (line 11) | constructor() {
    method _generateUniqueId (line 22) | _generateUniqueId() {
    method _loadHistory (line 26) | async _loadHistory() {
    method _saveHistory (line 41) | async _saveHistory() {
    method addDownload (line 52) | async addDownload(downloadInfo) {
    method getHistory (line 81) | async getHistory() {
    method getFilteredHistory (line 86) | async getFilteredHistory(options = {}) {
    method getHistoryItem (line 114) | async getHistoryItem(id) {
    method removeHistoryItem (line 119) | async removeHistoryItem(id) {
    method clearHistory (line 131) | async clearHistory() {
    method getStats (line 138) | async getStats() {
    method exportAsJSON (line 164) | async exportAsJSON() {
    method _sanitizeCSVField (line 169) | _sanitizeCSVField(value) {
    method exportAsCSV (line 186) | async exportAsCSV() {

FILE: src/index.js
  function getId (line 6) | function getId(id) {
  function selectVideo (line 21) | function selectVideo(){
  function selectAudio (line 30) | function selectAudio(){

FILE: src/playlist.js
  method init (line 88) | init() {
  method loadInitialConfig (line 106) | loadInitialConfig() {
  method initEventListeners (line 142) | initEventListeners() {
  method startDownload (line 216) | startDownload(type) {
  method buildBaseArgs (line 259) | buildBaseArgs() {
  method getVideoArgs (line 290) | getVideoArgs() {
  method getAudioArgs (line 345) | getAudioArgs() {
  method getThumbnailArgs (line 376) | getThumbnailArgs() {
  method getLinkArgs (line 385) | getLinkArgs() {
  method handleDownloadEvents (line 400) | handleDownloadEvents(process, type) {
  method pasteLink (line 466) | pasteLink() {
  method updatePlaylistUI (line 474) | updatePlaylistUI(count, type) {
  method updateDynamicConfig (line 510) | updateDynamicConfig() {
  method hideOptions (line 541) | hideOptions(justHide = false) {
  method finishDownload (line 558) | finishDownload(count) {
  method showError (line 573) | showError(error) {
  method openDownloadsFolder (line 590) | openDownloadsFolder() {
  method toggleDownloadType (line 606) | toggleDownloadType(type) {
  method updateVideoTypeVisibility (line 618) | updateVideoTypeVisibility() {
  method toggleAdvancedMenu (line 624) | toggleAdvancedMenu() {
  method closeMenu (line 631) | closeMenu() {
  method navigate (line 639) | navigate(type, page) {
  method getFfmpegPath (line 645) | getFfmpegPath() {
  method getJsRuntimePath (line 669) | getJsRuntimePath() {

FILE: src/playlist_new.js
  function getId (line 51) | function getId(id) {
  function pasteLink (line 55) | function pasteLink() {
  function formatTime (line 139) | function formatTime(seconds) {
  function closeMenu (line 158) | function closeMenu() {

FILE: src/preferences.js
  function getId (line 45) | function getId(id) {
  function changeLanguage (line 127) | function changeLanguage() {
  function reload (line 214) | function reload() {
  function showPopup (line 314) | function showPopup(text, isError = false) {

FILE: src/renderer.js
  constant CONSTANTS (line 9) | const CONSTANTS = {
  class YtDownloaderApp (line 91) | class YtDownloaderApp {
    method constructor (line 92) | constructor() {
    method initialize (line 136) | async initialize() {
    method _setupDirectories (line 168) | _setupDirectories() {
    method _configureTray (line 225) | _configureTray() {
    method _configureAutoUpdate (line 238) | _configureAutoUpdate() {
    method _initializeTranslations (line 258) | async _initializeTranslations() {
    method _findOrDownloadYtDlp (line 275) | async _findOrDownloadYtDlp() {
    method _runBackgroundUpdate (line 353) | _runBackgroundUpdate(executablePath, isMacOS) {
    method ensureYtDlpBinary (line 406) | async ensureYtDlpBinary(defaultYtDlpPath) {
    method _findFfmpeg (line 470) | async _findFfmpeg() {
    method _getJsRuntimePath (line 500) | async _getJsRuntimePath() {
    method _loadSettings (line 552) | _loadSettings() {
    method _addEventListeners (line 605) | _addEventListeners() {
    method pasteAndGetInfo (line 746) | pasteAndGetInfo() {
    method getInfo (line 754) | async getInfo(url) {
    method handleDownloadRequest (line 796) | handleDownloadRequest(type) {
    method _fetchVideoMetadata (line 831) | _fetchVideoMetadata(url) {
    method _startDownload (line 895) | _startDownload(job) {
    method _queueDownload (line 951) | _queueDownload(job) {
    method _processQueue (line 978) | _processQueue() {
    method _prepareDownloadArgs (line 995) | _prepareDownloadArgs(job) {
    method _handleDownloadCompletion (line 1123) | _handleDownloadCompletion(code, randomId, filename, ext, thumbnail) {
    method _handleDownloadError (line 1149) | _handleDownloadError(error, randomId) {
    method _updateDownloadOptionsFromUI (line 1177) | _updateDownloadOptionsFromUI() {
    method _resetUIForNewLink (line 1210) | _resetUIForNewLink() {
    method _populateFormatSelectors (line 1228) | _populateFormatSelectors(formats) {
    method _displayInfoPanel (line 1396) | _displayInfoPanel() {
    method _createDownloadUI (line 1428) | _createDownloadUI(randomId, job) {
    method _updateProgressUI (line 1461) | _updateProgressUI(randomId, progress) {
    method _showDownloadSuccessUI (line 1501) | _showDownloadSuccessUI(randomId, filename, ext, thumbnail) {
    method _showError (line 1552) | _showError(errorMessage, url) {
    method _hideInfoPanel (line 1564) | _hideInfoPanel() {
    method _showPopup (line 1579) | _showPopup(text, isError = false) {
    method _closeMenu (line 1615) | _closeMenu() {
    method _cancelDownload (line 1628) | _cancelDownload(id) {
    method _fadeAndRemoveItem (line 1648) | _fadeAndRemoveItem(id) {
    method _clearAllDownloaded (line 1659) | _clearAllDownloaded() {
    method _updateClearAllButton (line 1668) | _updateClearAllButton() {
    method _defaultVideoToggle (line 1677) | _defaultVideoToggle() {
    method parseTime (line 1692) | parseTime(timeString) {
    method _formatTime (line 1727) | _formatTime(duration) {
    method _updateSliderUI (line 1751) | _updateSliderUI(movedSlider) {
    method setVideoLength (line 1832) | setVideoLength(duration) {

FILE: src/types.d.ts
  type format (line 1) | type format = {
  type info (line 17) | type info = {

FILE: translations/i18n.js
  function normalizeLocale (line 3) | function normalizeLocale(locale) {
  function getLocale (line 30) | async function getLocale() {
  function I18n (line 58) | function I18n() {
Condensed preview — 56 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (493K chars).
[
  {
    "path": ".gitignore",
    "chars": 128,
    "preview": "node_modules\nrelease\ntest.js\n.*\n!/.gitignore\ntodo.txt\nffmpeg*\nffmpeg.exe\ngenerated-sources.json\nffmpeg.patch\ndeno*\nnode."
  },
  {
    "path": "LICENSE",
    "chars": 35149,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "README.md",
    "chars": 9459,
    "preview": "<img src=\"https://github-production-user-asset-6210df.s3.amazonaws.com/66430340/238887646-33b4cba9-3c45-4042-83d1-b79e94"
  },
  {
    "path": "assets/css/extra.css",
    "chars": 7243,
    "preview": "@font-face {\n\tfont-family: \"JetBrains\";\n\tsrc: url(\"../fonts/JetBrainsMono-Regular.ttf\") format(\"truetype\");\n}\n\n:root[the"
  },
  {
    "path": "assets/css/index.css",
    "chars": 19888,
    "preview": "@font-face {\n\tfont-family: \"JetBrains\";\n\tsrc: url(\"../fonts/JetBrainsMono-Regular.ttf\") format(\"truetype\");\n}\n\n@font-fac"
  },
  {
    "path": "crowdin.yml",
    "chars": 86,
    "preview": "files:\n  - source: /translations/en.json\n    translation: /translations/%locale%.json\n"
  },
  {
    "path": "flatpak/io.github.aandrew_me.ytdn.desktop",
    "chars": 178,
    "preview": "[Desktop Entry]\nName=ytDownloader\nComment=Download videos and audios from YouTube and other sites\nExec=run.sh\nType=Appli"
  },
  {
    "path": "flatpak/io.github.aandrew_me.ytdn.metainfo.xml",
    "chars": 8437,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<component type=\"desktop\">\n  <id>io.github.aandrew_me.ytdn</id>\n  <name>ytDownloa"
  },
  {
    "path": "html/about.html",
    "chars": 2103,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <meta charset=\"UTF-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=e"
  },
  {
    "path": "html/compressor.html",
    "chars": 8975,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-widt"
  },
  {
    "path": "html/history.html",
    "chars": 26690,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <meta charset=\"UTF-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=e"
  },
  {
    "path": "html/index.html",
    "chars": 12653,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <header></header>\n    <meta charset=\"UTF-8\">\n    <meta http-equiv=\"X-UA-Com"
  },
  {
    "path": "html/playlist.html",
    "chars": 8456,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <meta charset=\"UTF-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=e"
  },
  {
    "path": "html/playlist_new.html",
    "chars": 3250,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <meta charset=\"UTF-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=e"
  },
  {
    "path": "html/preferences.html",
    "chars": 7829,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n    <meta charset=\"UTF-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=e"
  },
  {
    "path": "linux.sh",
    "chars": 527,
    "preview": "#!/bin/bash\n\n# >> Check if curl is installed or nor\nif ! command -V curl > /dev/null 2>&1; then\n    echo \"curl not insta"
  },
  {
    "path": "mac.sh",
    "chars": 863,
    "preview": "#!/bin/bash\n# >> Check if curl is installed or nor\nif ! command -v curl > /dev/null 2>&1; then\n    echo \"curl not instal"
  },
  {
    "path": "main.js",
    "chars": 13103,
    "preview": "const {\n\tapp,\n\tBrowserWindow,\n\tdialog,\n\tipcMain,\n\tshell,\n\tTray,\n\tMenu,\n\tclipboard,\n} = require(\"electron\");\nconst {autoU"
  },
  {
    "path": "package.json",
    "chars": 2413,
    "preview": "{\n\t\"dependencies\": {\n\t\t\"electron-updater\": \"^6.6.2\",\n\t\t\"systeminformation\": \"^5.25.11\",\n\t\t\"yt-dlp-wrap-plus\": \"^2.4.3\"\n\t"
  },
  {
    "path": "src/common.js",
    "chars": 2905,
    "preview": "const electron = require(\"electron\");\n/**\n *\n * @param {string} id\n * @returns {any}\n */\nfunction getId(id) {\n\treturn do"
  },
  {
    "path": "src/compressor.js",
    "chars": 15552,
    "preview": "const {exec, execSync} = require(\"child_process\");\nconst path = require(\"path\");\nconst {ipcRenderer, shell} = require(\"e"
  },
  {
    "path": "src/history.js",
    "chars": 4602,
    "preview": "/**\n * Download History Manager\n */\n\nconst fs = require(\"fs\");\nconst path = require(\"path\");\nconst crypto = require(\"cry"
  },
  {
    "path": "src/index.js",
    "chars": 1074,
    "preview": "const videoToggle = getId(\"videoToggle\");\nconst audioToggle = getId(\"audioToggle\");\nconst incorrectMsg = getId(\"incorrec"
  },
  {
    "path": "src/playlist.js",
    "chars": 19942,
    "preview": "const {clipboard, ipcRenderer} = require(\"electron\");\nconst {default: YTDlpWrap} = require(\"yt-dlp-wrap-plus\");\nconst pa"
  },
  {
    "path": "src/playlist_new.js",
    "chars": 5052,
    "preview": "const { clipboard, shell, ipcRenderer } = require(\"electron\");\nconst { default: YTDlpWrap } = require(\"yt-dlp-wrap-plus\""
  },
  {
    "path": "src/preferences.js",
    "chars": 9509,
    "preview": "const {ipcRenderer, shell} = require(\"electron\");\nconst {accessSync, constants} = require(\"original-fs\");\nconst {join} ="
  },
  {
    "path": "src/renderer.js",
    "chars": 50505,
    "preview": "const {shell, ipcRenderer, clipboard} = require(\"electron\");\nconst {default: YTDlpWrap} = require(\"yt-dlp-wrap-plus\");\nc"
  },
  {
    "path": "src/types.d.ts",
    "chars": 481,
    "preview": "type format = {\n    vcodec?: string,\n    acodec?: string,\n    ext: string,\n    filesize?: number,\n    format_id: string,"
  },
  {
    "path": "translations/ar-SA.json",
    "chars": 7062,
    "preview": "{\n\t\"preferences\": \"الإعدادات\",\n\t\"about\": \"عن التطبيق\",\n\t\"downloadLocation\": \"مسار التنزيل\",\n\t\"currentDownloadLocation\": "
  },
  {
    "path": "translations/bn-BD.json",
    "chars": 7549,
    "preview": "{\n\t\"preferences\": \"পছন্দসমূহ\",\n\t\"about\": \"তথ্য\",\n\t\"downloadLocation\": \"ডাউনলোডগুলির স্থান\",\n\t\"currentDownloadLocation\": "
  },
  {
    "path": "translations/de-DE.json",
    "chars": 8040,
    "preview": "{\n\t\"preferences\": \"Einstellungen\",\n\t\"about\": \"Über\",\n\t\"downloadLocation\": \"Download-Verzeichnis\",\n\t\"currentDownloadLocat"
  },
  {
    "path": "translations/el-GR.json",
    "chars": 8109,
    "preview": "{\n\t\"preferences\": \"Προτιμήσεις\",\n\t\"about\": \"Σχετικά με\",\n\t\"downloadLocation\": \"Τοποθεσία λήψεων\",\n\t\"currentDownloadLocat"
  },
  {
    "path": "translations/en.json",
    "chars": 7137,
    "preview": "{\n\t\"preferences\": \"Preferences\",\n\t\"about\": \"About\",\n\t\"downloadLocation\": \"Download location\",\n\t\"currentDownloadLocation\""
  },
  {
    "path": "translations/es-ES.json",
    "chars": 7907,
    "preview": "{\n\t\"preferences\": \"Preferencias\",\n\t\"about\": \"Acerca de\",\n\t\"downloadLocation\": \"Ubicación de la descarga\",\n\t\"currentDownl"
  },
  {
    "path": "translations/fa-IR.json",
    "chars": 7478,
    "preview": "{\n\t\"preferences\": \"تنظیمات\",\n\t\"about\": \"درباره\",\n\t\"downloadLocation\": \"مکان بارگیری\",\n\t\"currentDownloadLocation\": \"مکان "
  },
  {
    "path": "translations/fi-FI.json",
    "chars": 7693,
    "preview": "{\n\t\"preferences\": \"Asetukset\",\n\t\"about\": \"Tietoja\",\n\t\"downloadLocation\": \"Latausten kohdekansio\",\n\t\"currentDownloadLocat"
  },
  {
    "path": "translations/fr-FR.json",
    "chars": 8201,
    "preview": "{\n\t\"preferences\": \"Préférences\",\n\t\"about\": \"À propos\",\n\t\"downloadLocation\": \"Emplacement des téléchargements\",\n\t\"current"
  },
  {
    "path": "translations/hi-IN.json",
    "chars": 7525,
    "preview": "{\n\t\"preferences\": \"प्राथमिकताएं\",\n\t\"about\": \"के बारे में\",\n\t\"downloadLocation\": \"डाउनलोड स्थान\",\n\t\"currentDownloadLocati"
  },
  {
    "path": "translations/hu-HU.json",
    "chars": 7766,
    "preview": "{\n\t\"preferences\": \"Beállítások\",\n\t\"about\": \"Névjegy\",\n\t\"downloadLocation\": \"Letöltés helye\",\n\t\"currentDownloadLocation\":"
  },
  {
    "path": "translations/i18n-init.js",
    "chars": 193,
    "preview": "const I18n = require(\"../translations/i18n\");\nconst i18n = new I18n();\n\n(async () => {\n\tawait i18n.init();\n\tdocument.dis"
  },
  {
    "path": "translations/i18n.js",
    "chars": 2475,
    "preview": "const {ipcRenderer} = require(\"electron\");\n\nfunction normalizeLocale(locale) {\n\tif (!locale) return \"en\";\n\tconst parts ="
  },
  {
    "path": "translations/it-IT.json",
    "chars": 7634,
    "preview": "{\n\t\"preferences\": \"Preferenze\",\n\t\"about\": \"Informazioni\",\n\t\"downloadLocation\": \"Posizione di download\",\n\t\"currentDownloa"
  },
  {
    "path": "translations/ja-JP.json",
    "chars": 5752,
    "preview": "{\n\t\"preferences\": \"環境設定\",\n\t\"about\": \"概要\",\n\t\"downloadLocation\": \"ダウンロード場所\",\n\t\"currentDownloadLocation\": \"現在のダウンロード場所 - \","
  },
  {
    "path": "translations/ne-NP.json",
    "chars": 7793,
    "preview": "{\n\t\"preferences\": \"सेटिङहरू\",\n\t\"about\": \"बारेमा\",\n\t\"downloadLocation\": \"डाउनलोड स्थान\",\n\t\"currentDownloadLocation\": \"हाल"
  },
  {
    "path": "translations/pl-PL.json",
    "chars": 7688,
    "preview": "{\n\t\"preferences\": \"Ustawienia\",\n\t\"about\": \"O programie\",\n\t\"downloadLocation\": \"Lokalizacja pobierania\",\n\t\"currentDownloa"
  },
  {
    "path": "translations/pt-BR.json",
    "chars": 7679,
    "preview": "{\n\t\"preferences\": \"Preferências\",\n\t\"about\": \"Sobre\",\n\t\"downloadLocation\": \"Local para salvar\",\n\t\"currentDownloadLocation"
  },
  {
    "path": "translations/ru-RU.json",
    "chars": 7566,
    "preview": "{\n\t\"preferences\": \"Настройки\",\n\t\"about\": \"О программе\",\n\t\"downloadLocation\": \"Папка загрузки\",\n\t\"currentDownloadLocation"
  },
  {
    "path": "translations/tr-TR.json",
    "chars": 7499,
    "preview": "{\n\t\"preferences\": \"Ayarlar\",\n\t\"about\": \"Hakkında\",\n\t\"downloadLocation\": \"İndirme dizini\",\n\t\"currentDownloadLocation\": \"M"
  },
  {
    "path": "translations/uk-UA.json",
    "chars": 7592,
    "preview": "{\n\t\"preferences\": \"Налаштування\",\n\t\"about\": \"Про застосунок\",\n\t\"downloadLocation\": \"Шлях завантаження\",\n\t\"currentDownloa"
  },
  {
    "path": "translations/vi-VN.json",
    "chars": 7421,
    "preview": "{\n\t\"preferences\": \"Tùy chỉnh\",\n\t\"about\": \"Giới thiệu\",\n\t\"downloadLocation\": \"Vị trí tải xuống\",\n\t\"currentDownloadLocatio"
  },
  {
    "path": "translations/zh-CN.json",
    "chars": 4958,
    "preview": "{\n\t\"preferences\": \"设置\",\n\t\"about\": \"關於\",\n\t\"downloadLocation\": \"下載位置\",\n\t\"currentDownloadLocation\": \"目前下載位置 - \",\n\t\"enableTr"
  },
  {
    "path": "translations/zh-TW.json",
    "chars": 4954,
    "preview": "{\n\t\"preferences\": \"設定\",\n\t\"about\": \"關於\",\n\t\"downloadLocation\": \"下載位置\",\n\t\"currentDownloadLocation\": \"目前下載位置 - \",\n\t\"enableTr"
  },
  {
    "path": "tsconfig.json",
    "chars": 159,
    "preview": "{\n    \"compilerOptions\": {\n        \"allowJs\": true,\n        \"checkJs\": true,\n        \"lib\": [\n            \"ES2021.String"
  },
  {
    "path": "windows.ps1",
    "chars": 394,
    "preview": "Invoke-WebRequest -Uri \"https://github.com/aandrew-me/ffmpeg-builds/releases/download/v8/node.exe\" -OutFile node.exe\nInv"
  },
  {
    "path": "ytdownloader.json",
    "chars": 670,
    "preview": "{\n\t\"homepage\": \"https://ytdn.netlify.app\",\n\t\"version\": \"3.20.2\",\n\t\"description\": \"A modern GUI App for downloading Video"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the aandrew-me/ytDownloader GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 56 files (431.6 KB), approximately 127.9k tokens, and a symbol index with 131 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!